- #1

- 1

- 0

Hello guys,

i want ALU implemented in gate level in verilog, plz help me

i want ALU implemented in gate level in verilog, plz help me

You are using an out of date browser. It may not display this or other websites correctly.

You should upgrade or use an alternative browser.

You should upgrade or use an alternative browser.

- Thread starter alt3r
- Start date

- #1

- 1

- 0

Hello guys,

i want ALU implemented in gate level in verilog, plz help me

i want ALU implemented in gate level in verilog, plz help me

- #2

- 417

- 1

Just set up three registers (or bit-level flip-flops) for the number of bits that you wish to deal with.

1. Instruction control register - Usually just 3 or 4 bits wide

2. Register A (for accumulator) - Might be 8, 16, 32, or whatever you want

3. Register B - Must be the same size as register A

Then just write the code based on the contents of the control register.

In other words, if the control register contains say 000 then have Register B AND with register A leaving the result in A.

If the control register contains say 001 then have register B OR with register A leaving the resultes in A.

You can do similar things with various binary codes in your control register.

It's a pretty simple routine. Once you have the three registers defined, the rest is just IF THEN statements of the form:

IF control=000 THEN A = B LOGIC A

IF control=001 THEN A = B LOGIC A

IF control=010 THEN A = B LOGIC A

IF control=011 THEN A = B LOGIC A

IF control=100 THEN A = B LOGIC A

IF control=001 THEN A = B LOGIC A

Where "LOGIC" is something like AND, OR, NOT, ADD, SUB, ect.

And so on. If you need more control make the control register 4-bits wide or wider.

You might also want to impliment a carry flag, or other types of flags. Keep going and the next thing you know you'll be designing a microprocessor!

Hope this helps. You'll still have to work out the actual syntax and initial register set up, but if you are taking a course in this that part should be relatively straight-forward.

Here's a link to a similar assignment, it doesn't give the answer but by it might be helpful:

http://www.u-aizu.ac.jp/~yliu/teaching/comparch/lab1.html

- #3

- 417

- 1

IF control=000 THEN D = B LOGIC A

IF control=001 THEN D = B LOGIC A

IF control=010 THEN D = B LOGIC A

IF control=011 THEN D = B LOGIC A

IF control=100 THEN D = B LOGIC A

IF control=001 THEN D = B LOGIC A

This way you will be guaranteed good results without the possibiliy of causing a closed loop. It's actually been a while since I've done any HDL so maybe others will respond with some better ideas.

Share: