Saturday, 20 December 2014

embedded - How are most ALUs built, and is it possible to 'build your own'?


I've been REALLY really trying to learn about the very low level of computers. I've been looking at a lot of homebrew pages and it's quite a lot to take in. I took classes in electronic engineering in college, but we didn't really go into super depth on the subject (it was computer science, so most of it was in fact algorithms and such).


Anyway, how are/were most ALUs built? I realize that's not the only part of a computer, but still it's an important part.


And could you sort of build your own ALU just using logic gates (for learning purposes)? I understand this probably sounds stupid to those more knowledgeable, but I'm just trying to understand. (Heck, even a simple adder would be a neat project.) If so, how would this be done? Are there any hardware examples? (I've looked around Google, but I can't find anything that kind of has a step-by-step guide explaining things).



Answer



You can build them completely from basic logic gates, and the result will be a nice piece of art :-).


The 74xx logic series also contains a 74LS181, a 4-bit slice ALU, which simplifies things drastically. Bit slice ALU's were used to build more complex ALUs (read: longer word lengths), but newer technologies have made this kind of ICs obsolete.

note: TTL (74xx) is just one technology used for logic gates. Rarely used anymore. It was followed by Low-Power Schottky: 74LSxx, strictly speaking also a form of TTL. Nowadays there are dozens of logic families, all based on high-speed CMOS (74HCxx, 74HCTxx, 74ACxx,...)


These days the proper way to create an ALU would be to do it in a CPLD or an FPGA. This gives you a lot of gates, and the HDL (Hardware Description Language) you use to design the ALU is a lot easier and less error-prone than trying to figure out how to make the connections yourself with the logic gates. VHDL and Verilog are the HDLs of the day.


An alternative method to create an ALU (not using logic gates, though), would be a single parallel EEPROM/Flash. You use inputs A and B and the operation as input (address) and get the result of the operation as output (data). All you have to do is compile the ROM's content, meaning that you have to write at every address what the result of the operation will be for the corresponding inputs A, B and operation. Word size will be limited by the largest ROM size you can find.


No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...