Lab 4 FAQ 2
1) Q: I am a little lost....can you describe what is going on in lab 4?
A: You are essentially designing an ALU. Please see the lab lecture
notes for an overall picture. Basically you feed some input
into the ALU, and based on that input, the ALU performs some
operation and then creates some output. For example, suppose
we want to add two numbers, 4 + 5. The output should clearly
be 9, but how do we get this complicated circuit to do this?
Well, first we need to put 4 and 5 into the registers as the data
to be operated on. We would do this by first performing a move1
to put 4 into register 1. The command for move 1 is 001 followed
by the 4 bit data, thus our command would be 001 0100 (remeber your
binary, IE CSE30). We then move 5 into register 2 via the move 2
command. The command for move 2 is 010 followed by the 4 bit data,
thus our command would be 010 0101. Now that we have the data we
want added in register 1 and register 2, we must tell the ALU to
add these two numbers. We use the add command to do this, which
consits of 100 followed by dont cares, thus the input would
be 100 XXXX (X is dont care). The output will then be 1001 for
binary 9, and will be store in register 3. So that is essentially
how you circuit should function.
2) Q: I am so lost! I dont know where to start. What should I do?
A: Take it one step at a time. Once you have the overall picture of
what your ALU is supposed to look like (look at the lab lecture
notes), start small. First build your 4-bit adder(with buses), and
make sure it works. Then get the shifter, comparator, and mask
modules working (remeber you need to use buses for ALL of these).
Now you have all the basic components done. Next get your control
unit working. See the ABEL Truth Table Tutorial to help you with that.
Now you just need to add in all these components, add in your registers,
add in your MUXs(Need to use buses), and link everything up. Then Test
Test and TEST MORE!!!!
3) Q: What components would you suggest I use for this lab?
A: You can make macros for all the functions WITH BUSES using the
following. For the 4 bit adder, Xilinx has a built in 4 bit
adder called "ADD 4". You can connect the first four inputs to
one input bus, the second 4 inputs to a second input bus, the 4
outputs to an output bus, CL (Clear) to the "GND" component
for 0, CO (Carry Out) to an output terminal, and ignore the OFL
bit which won't work right for this lab. For the mask function,
you will just need two input buses, an output bus, and 4 2-bit
AND gates. For the shifter, use BRLSHFT4 with a 4 bit input bus,
a 4 bit output bus, and two terminals for S0 and S1 (the number of
bits to shift). For the comparator, use a COMPM4 ans see the first FAQ
for a hint. For the registers, use FD4CE.