VHDL code

Thread Starter

cs_

Joined Oct 19, 2009
4
i have homework and i want to solve it :(


Write the VHDL code for a​
32-Bit Subtractor, using a Carry Look Ahead adder and then simulate it.

You must use the process statement in your code. For the subtractor use 2’s Complimen



can any one help me :(


 

scythe

Joined Mar 23, 2009
49
All a process statement does in VHDL is execute when a signal in your parameter list changes. You would have to come up with the design for your 32 bit subtractor and then figure out when you would want it to run. Then figure out the signal (or signals) that should trigger a process to help it execute.

It would also be helpful if you had some code so we can get a better idea of what you're trying to do. There are many ways to implement this...
 

Thread Starter

cs_

Joined Oct 19, 2009
4
Calculating the adder’s next carry:​
C​
OUT = Ci+1 = Ai.Bi + (Ai Bi).Ci

C​
i+1 = Gi + Pi.Ci

Generate Function:​
G​
i = Ai.Bi

The Gi is equal to binary 1 when both A and B are binary 1, regardless of the value of the incoming
carry to the stage Ci,​
Propagate Function:​
Pi = (A​
i Bi)

The function Pi is equal to binary 1 when either A and B is binary 1, in this case a carry out is
produced if Ci =1​
 

Thread Starter

cs_

Joined Oct 19, 2009
4
Calculating the Next carry for a Four-bit adder:​
C​
1 = G0 + P0.C0

C​
2 = G1 + P1.C1 = G1 + P1.G0 + P1.P0.C0

C​
3 = G2 + P2.G1 + P2.P1.G0 + P2.P1.P0.C0

C​
4 = G3 + P3.G2 + P3.P2.G1 + P3.P2.P1.G0 + P3.P2.P1.P0.C0

Calculating the Sum:​
Si = Ai Bi Ci = PiCi.
 
Top