Homework 1
Due Sunday, January 24
In this homework you will use Chipmunk (diglog) to implement the simple computer described in the last section of our class material "Digital Logic---the Bare Minimum."
To keep things simpler, we will make several changes: Word size (register and ALU operand size) is 2 bits; address size is 4 bits; there are 4 registers; the op codes are
000 dst = src1 + src2 001 dst = src1 - src2 010 dst = src1 AND src2 011 dst = NOT src1 100 if N go to branch target 101 if Z go to branch target 110 go to branch target
It is required that you design and use the following diglog modules in your work:
Arithmetic and Logic Unit. Inputs are the lower 2 bits of the op code, and the 2 2-bit operands. Outputs are the 2-bit result, and the N and Z bits.
I have designed this module for you; click here to get the .lgf file.
Decodes the 3-bit op code to test for jump. Inputs are the 3-bit op code, and N and Z. Output is 1-bit jump indicator; 1 means jump to the branch target.
Includes the program counter, the incrementer and the MUX. Inputs are the 4-bit "branch target" field of the current instruction. the jump indicator (output of the JUMP module), and the 1-bit clock line. Output is the new 4-bit PC value.
A 2-bit register. (You will use 4 REG modules in your overall system.) Input consists of the 1-bit clock line, a 2-bit connection to the ALU-output bus, and 3 1-bit enable lines for the 3 buses. Output consists of 2 2-bit connections to the ALU-input buses.
Use 2 SRAM8K chips for your program memory. Enter your test programs using the "configuration" method described in the Chipmunk mini-manual.
Use a Digital Pulse Generative Switch for your clock. Use as many clock cycles per instruction as you like (though one cycle is enough).
Again, all of the above specifications, including the modularization, are required. The purpose of requiring this is to achieve enough of a level of uniformity to make life easier for the TA (since some of you will be coming to him for help in debugging, this uniformity will make it easier for him to help you) and the Reader (for whom the uniformity will make grading easier).
Make sure you test your design well; write your test programs in a way which will make for a thorough testing of your system. Be ready for anything, since you do not know what programs the Reader will use to test your circuit with.
Note: Unless you add logic to your REG module which allows you to manually load constants into a register before running a program (which is fine, if you wish to do this), then all your registers will contain 0s---which would not make for a very interesting test of your circuit! So you need to make sure that your test program works with some nonzero values in the registers, and to do this you will need to write the first few instructions in your program in a way that will generate some nonzero values. For instance, you can apply a NOT instruction to a register which contains 00 to produce the value 11. Adding this register to itself yields 10, etc.