cs223ProjectProposalFall2020 v6
cs223ProjectProposalFall2020 v6
Single-cycle processor
Groups: Each student will do the project individually. Group size = 1
Important dates:
Report submission and project upload: 25.12.2020 Friday, until 08:40 AM.
You need to upload your design files in order to make your project demonsration.
Demo presentation day: 25, 26 December 2020.
Use this link to sign up for demo:
https://docs.google.com/spreadsheets/d/151pyWly_McKTh0gq2Iaw6aViPMCYNVB7Q8E3O-
56Oqo/edit?usp=sharing
Project summary:
Instructions:
The processor will work on 16-bit instructions where the most significant 3-bits will be used as
the opcode (abbreviated from operation code, also known as instruction code is the portion of
a machine language instruction that specifies the operation to be performed.). Depending on
the opcode, the controller will decide what to do, how to interpret the rest of the instruction,
and send the necessary control signals back to datapath.
Opcode Function
000 Store Value
001 Load Value
010 Addition
011 Reserved
100 Reserved
101 Branch if equals
110 Reserved
111 Reserved
Table 1: Instruction Set
Store Value:
If the opcode is 1’b000, the next bit will decide if the value to store should come immediately
taken from instruction or from a register in the register file. If the value is 1, the next 4-bits will
be used as the write address for data memory, and the remaining least significant 8 bits will be
used as the data value to be written. For example, instruction 000_1_0101_00000011 can be
translated as “write value 3 to address 5 of the data memory,” and therefore, address 5 of the
data memory must be 5 after this instruction is executed.
[15:13] Opcode=000 [12] Immediate bit=1 [11:8] Write Address [7:0] Write Data
(unsigned)
Table 2: Store Instruction Immediate
Else if the immediate bit value is 0, next 4-bits will be ignored, and the remaining 8-bits will be
used as write address of memory and read address from register file:
Ex: An instruction 000_0_XXXX_0010_0011 will put the value hold by register 3 to address 2 of
the data memory.
Load Value:
Load value will work similar to store value but in reverse direction. If the immediate bit after
the opcode is 0, it will read the value from read address of the data memory, and put it into the
register in the register file whose address is given. If the immediate bit is 1, it will load directly
the value in instruction’s least significant 8-bit to the given register.
Addition:
Ex 1: Instruction: 010_X_0000_0000_0001 will add the values in Register 0 and Register 1 and
put the result in Register 0, similar to “rf[0] += rf[1];” in a high level language.
Ex 2: Instruction: 010_X_0000_0001_0002 will add the values in Register 0 and Register 1 and
put the result in Register 0, similar to “rf[0] = rf[1] + rf[2];” in a high level language.
Branch if equals:
[15:13] Opcode=101 [12:8] Jump Addr [7:4] Read Reg Addr 1 [3:0] Read Reg Addr 2
Instruction Mem
Table 6: Branch if Instruction
This instruction tells the processor to jump to a certain instruction if the 2 given values are
equal. For the previous instructions, after the processor executes them, the next instruction to
fetch for processor will be the instruction that just comes after in the instruction memory.
However for branch if equals instruction, if the values whose addresses are given in “Read Reg
Addr 1” and “Read Reg Addr 2” are equal, the next instruction to fetch will be the instruction
whose address is given in “Jump Addr Instruction Mem,” else, the processor will continue to
execute the next instruction in order.
if (rf[0] == rf[1])
goto Jump Addr Instruction Mem
else
continue with next instruction
Stop Execution (Wait)
This instruction will stop the whole execution and processor will halt at this point.
The instruction memory should be able to hold 32 instructions and will be read-only memory.
Therefore the program you write will be hardcoded in the instruction memory. Both data
memory and the register file will hold 16x8 bit data, and they can have at most 2 read ports and
a single write port. Notice that all the computational instructions manipulate data on register
file, so you need to get the data you want to process into registers first. The register file will
take the next instruction as an input from the instruction memory (or directly from switches if
middle pushbutton is pressed), and place the components of the instruction (such as opcode or
DataAddress) to corresponding registers. The opcode will be sent to controller module as an
output so that controller will be able to send the necessary control signals such as writeEnable,
ALU opcode, jumpEnable. Both memory and register file contents will be zero on reset state,
and contents will be stored with load and store instructions.
There is only one way to update data memory which is through running a store instruction. On
the other hand for the register file, updates can occur through load instruction, but also
through addition instruction, as the sum is also written to register file.
Interface:
Push buttons, switches and seven-segment display will be used to interact with the processor.
Seven-segment display will be used to show the address and the data in memory with a
separator in middle (Figure 1). Right and left pushbuttons will be used to circulate in data
memory. Assume initially seven-segment displays address 0 in the first digit and the correlated
value in hex in the last 2 digits, pressing right button should display address 1 and the
correlated value, whereas pressing left button should display address 0xF and the correlated
data. The upper pushbutton will be used for reset. Middle pushbutton will be used to execute
the instruction entered on switches whereas the down pushbutton will be used to execute the
next instruction on instruction memory. The instruction to be executed next should be
displayed in LEDs.
Report: