You are on page 1of 11

[CprE 381] Computer Organization and Assembly-

Level Programming, Fall 2018


Project A Report

Name(s) ____Dalton_Sherratt_and_Isaac_Klein____

Section /Lab Time ____M_/_Wed_10am-12pm____

Refer to the highlighted language in the Project A instruction for the context of the following questions.

a. [Part 1.a] Provide a description of how each of the control values in the architecture (i.e., the outputs of
the main control unit) is used.

 For each output control signal, explain how it is used (i.e., what does it do?)

o o_reg_dest – Chooses between two registers entering a mux from InstrMem.


o o_jump – Chooses between the current address from the adder and the shifted left value or
jumped value.
o o_branch – If a value in the ALU is equivalent its zero output will become 1 and when it is
anded with the branch value of 1 a mux is turned on which links with the jump process from
above.
o o_mem_to_reg – controls a mux which chooses between a output from ALU and output from
Data Mem.
o o_ALU_op – Directly controls an ALU operation independent or reg data.
o o_mem_write – Links to data memory and enables it to be overwritten by the ALU.
o o_ALU_src – Selects a Mux that chooses from reg output 2 and a value store in instruction
memory which was extracted from data memory which was extracted from ALU last time.
o o_reg_write – links to the register to enable it to be overwritten.

 For the 6 MIPS instructions to support, ADD, ADDI, LW, SW, BEQ and J, complete the following
table.

ADD ADDI LW SW BEQ J


o_reg_dest 1 0 0 0 1 1
o_jump 0 0 0 0 0 1
o_branch 0 0 0 0 1 0
o_mem_to_reg 0 0 1 0 0 0
o_ALU_op 0000 0000 0000 0000 0001 0000
o_mem_write 0 0 0 1 0 0
o_ALU_src 0 1 1 1 0 0
o_reg_write 1 1 1 0 0 0

1|Page
 (continuing from the previous question) For each of the 6 MIPS instruction, explain why you set
the values as you described in the table above.

o ADD – reg-dest and reg-write are 1 because the added value is stored into a register.
o ADDI – ALU-src and reg-write are 1 because the integer source is from ALU and it is written
to the register.
o LW – mem-2-reg, ALU-src, and reg-write are all 1 because we are loading from memory and
writing it to a register using an integer from ALU as an offset.
o SW – mem-write and ALU-src are 1 because the reg value is written to memory using an
integer ALU offset.
o BEQ – reg-dest, branch, and ALU-op are all set to 1 because if two register values are equal it
branches to a set register destination.
o J – reg-dest and jump are 1 because it jumps to the register given.

b. [Part 1.a] How is the zero flag from the ALU used?

If an operation is output from the ALU that is equivalent to zero, a zero flag is activated which outputs
1 from the zero. That value is anded with the branch output so if they are both 1 then the jumping
process is activated, if either aren’t a 1 then the jump is bypassed.

c. [Part 2] Simulate your processor in ModelSim and run the provided program in imem.mif with the data
in dmem.mif.

 The [projectA > ASM Files > test_with_data_seg.asm ] file has the assembly code with data
specified which is equivalent to the given imem/dmem.mif. Before simulating the final design,
just by studying the code, please explain

o What the code does

# This program sums an array from memory. It stores the result in s0


# and it also saves the sum of the previous elements in memory at each
# index. This is meant to test the six instructions required for project A.

This program takes an array word which is 1-10 and for each number replaces each number
with its sum up todate until it reaches the end, so it should output:

1,3,6,10,15, 21,28,36,45,55

o Which values will be written on DMEM at the locations of the first 11 words staring from
the address 0.

1,3,6,10,15, 21,28,36,45,55, (55?)

o Which values will be written on the following registers: $8 (=$t0), $9 (=$t1), $10 (=$t2),
and $16 (=$s0).

$8 = 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 (where each is the current word and is decremented each


loop until == 0 )
$9 = &n, 4 + &list, 8 + &list, 12 + &list, … , 40 + &list (where &list is the address of the
list)
$10 = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 (where each is the loaded word within the loop)

2|Page
 Provide a screenshot for each of the 6 MIPS instructions to support showing the correct
functionality and explain how the instruction is working in accordance with the screenshot

o ADDI
 Adds an immediate value to the value at the address stored in dmem

o ADD
 Attach a screenshot & explain
 The add instruction takes the data in dmem in rs and adds it to the data in dmem at
rt

3|Page
o LW
 Attach a screenshot & explain
 Loads a word from the dmem into register file

4|Page
o SW
 Attach a screenshot & explain

o BEQ
 Attach a screenshot & explain
 Branches when alu_op flag equals one. This is the same as the zero flag within the
ALU VHDL code.

5|Page
o J

6|Page
7|Page
8|Page
9|Page
 Provide screenshots showing the final values of the dmem and registers
o DMEM (for the first 11 words starting from address 0)

o REGISTERS

10 | P a g e
11 | P a g e

You might also like