mkdir ~/cs355/hw6 cp /home/cs355001/Handouts/hw6/* ~/cs355/hw6 |
You will copy these files:
basic.h - the circuit components used in hw6 help-DataPath - the main simulation program file It creates switches and probes to help you test the circuit that you must make in the assignment datapath.h - This file contains the circuit that you must make for assignment 6 (turn this file in) run-hw6 - An application to compile and run the hw6 assignment |
|
When you're done with this assignment, your datapath will be able to execute machine instructions stored in the MIR. The MIR already contains 10 machine instructions for you to test your data path - see below in the write up for their descriptions. You will use them to test the correctness of your data path.
You can use these circuits in you datapath as if they are built-in cuircuits:
Define ALU16 a[15..0] b[15..0] c[1..0] | s[15..0] n z; Define SHIFTER16 a[15..0] c[1..0] | s[15..0]; |
(In other words: you do not need to define them yourself. Just use it as if they have been defined)
![]() |
Here is a diagram of the circuit test environment with the datapath circuit to give you the context in which the datapath circuit is used:
![]() |
The datapath component is the portion of the circuit within the read dotted bold lines in the figure.
Notice that the DataPath component contains the 16-bit ALU and 16-bit shifter from previous assignments.
These components have already been included by the circuit test environment main assignment file help-DataPath, so you can use them as if they are "built-in" components.
/* ================================================================= Pj6 code begins here Write the DataPath macro according to the handout ================================================================= */ Define DataPath mir[31..0] mbr[15..0] Phase[3..0] Reset | R0[15..0] R1[15..0] R2[15..0] R3[15..0] R4[15..0] R5[15..0] R6[15..0] R7[15..0] R8[15..0] R9[15..0] R10[15..0] R11[15..0] R12[15..0] R13[15..0] R14[15..0] R15[15..0] A[15..0] B[15..0] ALatch[15..0] BLatch[15..0] AMux[15..0] aluOut[15..0] C[15..0] N Z; /* Write EDiSim code here to execute the micro instruction in mir[31..0] */ Endef; |
|
|
|
|
Example: how to make a decoder with 3 selection signals that selects one of 2^3 = 8 outputs
Dec cb-eb ONE c[2..0] | out[7..0] ; |
Sample code: see sample-Dec in the assignment handout files (that you copied into your hw6 directory)
These circuits are defined in the basic.h that was copied in the preparation step. They are available for you to use in this assignment.
Syntax: ResetableReg16 coord in[15..0] ld reset | out[15..0]; Inputs: in[15..0] = 16 input bits ld = signal used to write the register (memory) when reset = Zero reset One: reset value in register to 0000000000000000 Zero: clk can now be used to write value into register Output: out[15..0] = the 16 bits value stored in the register |
Example on how to use this component:
|
Note:
|
I have made a number of constants in basic.h that you can use to construct the constant registers in the DataPath.
Use the following EDiSim code to make registers R5, R6, R7, R8 and R9:
Const_0 aa | R5[15..0]; Const_1 aa | R6[15..0]; Const_minus1 aa | R7[15..0]; Const_AMASK aa | R8[15..0]; Const_SMASK aa | R9[15..0]; |
Example on how to use these "Constants" components:
|
To test your DataPath component, you must fist complete (i.e., write) the DataPath component in the skeleton assignment file "datapath.h".
Run your assignment using the command:
(Make sure you are in your hw6 folder - use this command to go there: cd ~/cs355/hw6) bash run-hw6 |
|
|
Note:
|
/home/cs355001/turnin datapath.h hw6 |
(A 4th extension request will be automatically denied --- personal emergencies and illiness with documentation will receive a "free" extension)
/home/cs355001/req-ext hw6 |