The file control.sim contains an incomplete
implementation of the instruction set architecture (ISA) from Lab 2
and Lab 8. Your task is to complete the branch control, arithmetic
control, and memory control circuits.
branch control,
arithmetic control, and memory control
circuits. Use "don't care" when possible to simplify the tables. Translate each of the following assembly language programs into machine language. Enter the machine language into the program memory using hexadecimal notation. Run each program to test your CPU.
nop is a pseudo-instruction that does nothing. It is
equivalent to an unconditional branch with an address offset of 0.
Fill program memory with nop instructions. The program
counter should increase by 1 as each nop instruction is
executed.
nop # no operation (branch 0)
hlt is a pseudo-instruction that halts the CPU. It
is equivalent to an unconditional branch with an address offset of -1.
Replace one of the nop instructions with a
hlt instruction. The program counter should increase by
1 as each nop instruction is executed. The program
counter should stop changing when the hlt instruction is
reached.
hlt # halt (branch -1)
This program loads a value from the first location in data memory and copies it to the next location in data memory. Enter a hexadecimal value into the first data memory location before executing this program.
sub $0, $0 # clear R0 lw $1, 0($0) # load R1 from mem[0] sw $1, 1($0) # store R1 into mem[1]
This program loads a value from the first location in data memory, adds 1, then stores the result in the next location in data memory. Enter a hexadecimal value into the first data memory location before executing this program.
sub $0, $0 # address = 0 lw $1, 0($0) # load n from mem[0] addi $1, 1 # add 1 sw $1, 1($0) # store n+1 in mem[1]
This program loads a value n from the first location
in data memory and then fills the first n memory
locations with the values from 0 to n-1. Enter a
hexadecimal value into the first data memory location before executing
this program.
sub $0, $0 # n = 0 lw $1, 0($0) # limit = mem[0] loop: sw $0, 0($0) # mem[n] = n addi $0, 1 # n++ cmp $0, $1 # compare n to limit blt loop # while(n < limit) hlt # halt
Each team should hand in a written report including the following:
Also place one copy of the file control.sim in the
~/courses/201/assignments directory of one team member.
Send e-mail to your instructor indicating where the file can be found.
Be sure that your names appear in the comments for the main
circuit.