I am going to be wiring up an ALU IC for a school wall display (yeah...cos posters are old school).
I have just bought a stick of SN74LS181N 4 bit ALUs that take two 4bit words to do the functions on and a single 4bit word to select the function you want the ALU to perform on the two input 4bit words.
All great so far and I am happy with truth tables and have used 4bit adders before so yeah...
The bit where I am stuck is the issue of multiple carrying.
Say you had both 4 bit words as 1111, giving A=1111 and B=1111, when multiplying, this gives 15*15 = 175.
The output 175 in binary requires 8 bits.
The IC from the datasheet has a 4 bit out and 2 "carry" pins. One pin called C and one C(n+4) pin.
What on Earth am I meant to do :|?
I also got some SN74LS182N from Motorolla that are "look ahead carrys" if they help at all?
The presentation format isn't the only thing old school...
Quick look at the datasheet indicates that Cn is an input. Cn+4 is the carry output. See page 5 in particular, and the truth table.
Yeah sorry, my bad. So what is the Cn+4?
It is a basic poster showing the parts to a CPU. This is a school of kids 11-14 years old...so I am making it more of an "interactive" board where they can flip switches and LEDs light up to show their selections. A button pad on an ATtiny85 analog pin will be used to set the 4bit word for the ALU function.
I have been browsing google...seems a lot of people only multiply a 3bit by 4bit word on these things....surely there is a way to get it to use the full 4bit word inputs and somehow give the 8bit multilication bit space required? Even if I have to use one or two extra ICs it would be great!
DrAzzy:
Cn+4 is the carry output if I'm reading that right.
Yeah, this is where I am stuck. Only one carry out.
So how do you get to do 4bits * 4bits? This can give a possible 8bit output value. The spec sheets shows 4 output bits and the one carry...
At any of the other pins what I need in order to account for this?
This is why I am quite sure a second IC is needed...they seem to mention these SN182N ICs a lot...so I bought some of those.
Page 3 of the datasheet for the 4 bit ALU shows a scehmatic with this SN182N "lookahead carry" thingy. This has on it, listed C+8, C+16, C+32 which to me...looks like the extra bits I may be looking for...but can not seem to get my head around either if this is true or even if it is true...how it works?
In the summary of arithmetic operating modes on the first page of the datasheet it only refers to addition and subtraction. If it did multiply it would certainly have said so and it would have had the extra outputs for the result.
The carry out is connected to the carry in of another chip when you want to use two chips to give you an eight bit wide word to work with.
As others have said it will not multiply. The ALU in most early micro processors had no multiply instruction. You have to generate a multiply by using this ALU with an algorithem, it requires many steps. In other words you need a programming capability.
I am not aware of any. You could use a 64 byte ROM and put your two lots of four bits in and have your answer as the 8 bit output. You would need to program the contents to give you the multiplication output.
With bigger ROMs you could use the extra address lines for bank switching more arethmetic functions.