Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

bsteen/cpeg324-lab1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cpeg324-lab1

CPEG 324 - Lab 1, 8 Bit Calculator ISA Simulator

The goal of this lab was for us to implement our own 8 bit calculator ISA simulator. The translated binary code for the test benches and the expected outputs are given below. Type "make build" to compile the program. Then enter "./simulator " to run one of the test bench files.

Each line corresponds to a binary string in the given file. Next to the line is the expected output.
Test-load-print1:
print(R0, decimal) => 0
print(R1, decimal) => 0
print(R2, decimal) => 0
print(R3, decimal) => 0
R0 = 1
print(R0, decimal) => 1
print(R0, decimal) => 2
R0 = 3
print(R0, decimal) => 3
R0 = 4
print(R0, decimal) => 4
R0 = 5
print(R0, decimal) => 5
R0 = 6
print(R0, decimal) => 6
R0 = 7
print(R0, decimal) => 7
R0 = -8
print(R0, decimal) => -8
R0 = -7
print(R0, decimal) => -7
R0 = -6
print(R0, decimal) => -6
R0 = -5
print(R0, decimal) => -5
R1 = -4
print(R1, decimal) => -4
R3 = -3
print(R3, decimal) => -3
R4 = -2
print(R3, decimal) => -2
R4 = -1
print(R3, decimal) => -1

Test-load-print2:
R0 = 7
R0 = R0 + R0
R0 = R0 + R0
R0 = R0 + R0
print(R0, decimal) => 56
print(R0, hex) => 38
print(R0, ASCII) => 8
print(R0, decimal, hex, ASCII) => 56 => 38 => 8
R1 = -1
print(decimal, hex) => -1, => FF
print(R0, hex, ASCII) => 38 => 8

test-add-sub:
R0 = 1
R1 = 2
R3 = R1 + R0
print(R3, decimal) => 3
R3 = R3 + R3
print(R3, decimal) => 6
R3 = R3 + R3
print(R3, decimal) => 12
R4 = -8
R3 = R4 + R3
print(R3, decimal) => 4
R3 = R3 - R0
print(R3, decimal) => 3
R3 = R3 - R4
print(R3, decimal) => 11
R4 = R4 – R1
print(R4, decimal) => -9
R4 = R1 - R0
print(R4, decimal) => 1

test-cmp:
R0 = 7
R1 = 2
R2 = 2
compare(R1, R2, skip 1) Should compare as equals print(R2, decimal) *This should be skipped
compare(R1, R2, skip 2) Should compare as equals
print(R2, decimal) *This should be skipped
print(R2, decimal) *This should be skipped
compare(R0, R1, skip 1) *Should compare as not equals
print(R2, decimal) => 2
compare(R1, R0, skip 2) *Should compare as not equals
print(R0, decimal) => 7

Releases

No releases published

Packages

No packages published