DataPath (Bus regNo1, Bus regNo2, Bus writeRegNo, Bus immconst,The 'instruction' input in Figure 5.11 has been broken down into its constituent fields. The busses regNo1, regNo2, and writeRegNo are each 5 bits and specify the register numbers to read/write; immconst is an 18-bit bus which provides the input to the signextend unit in the data path. The remaining inputs correspond directly to those shown in the figure (bus ALUOp is 3 bits wide). There is no MemRead signal; our simple simulated memory is constantly performing a read. The clock input is not shown in the figure, but implicitly controls the flip-flops in the register file and memory.
Wire RegWrite, Wire MemWrite, Wire ALUSrc, Bus ALUOp, Wire MemtoReg, Wire clock)
You should use the ALU you built for assignment 2, and the register, memory, and sign-extension primitives provided in the latest version of the simulator. You need to define a Module for an n-bit, 2-way multiplexer (you'll need two of these for the data path), and then define a DataPath Module. The data memory component of the DataPath module should be given the component name "dmemory".
Testing this class is more complicated than the earlier classes you constructed. The circuit does not have any outputs; however, the simulator provides methods (Sim.get and Sim.getBus) for testing the value of any wire or bus inside the module, and new methods (Sim.setMemory and Sim.getMemory) for setting and testing the memory. This is a sequential circuit, so testing will have to be performed over a series of clock cycles. For each cycle, you
This test adds the contents of locations 1 and 2 of main memory and stores the result in location 3. Please code this test as (static) method test (with no arguments) of class Asgn4Test.lw 16,1
You should send email to firstname.lastname@example.org which contains a single attachment containing the definitions of the DataPath class, the Asgn4Test class, and any other classes you needed to define DataPath. The subject line of the message should be "Assignment 4". It will be easier for me if the attachment file name is yourname.java.
We will test your submission in two ways: by running our own tests on DataPath, and by initializing memory locations 1 and 2, running your test method, and examining memory location 3.
This assignment is due April 1st, and is worth 9 points towards your final grade. There is a penalty of 1/2 point for each school day the assignment is late.
Simulator for Assignment 3: This is an upgrade of the simulator, which includes additional primitives for registers, memory, and sign extension. Upgrade documentation. Java code (release 3.0).
An ALU Primitive is now also available.