JSR
From Ece
Contents |
Team Members
- Sam Shannon
- Richard Corey
- Jaron Martin
Design Overview
Our design consists of 16 instructions and 16 registers, both of which are indexed using a 4-bit wide address. Our instruction format is 16-bit with the 4-bit opcode contained within. This is in keeping with guidelines set in the class project, as opposed to the more standard 32-bit addressing scheme used in many modern processors.
Our architecture consists of an additional instruction format, I-Long. This increases the range of immediate values from 4 bits to 8 bits as opposed to the I-Format and its instruction format is described below.
Instruction Format
R-Format
| Opcode | RS | RT | RD |
|---|---|---|---|
| 4 Bits | 4 Bits | 4 Bits | 4 Bits |
I-Format
| Opcode | RS | RT | Immediate |
|---|---|---|---|
| 4 Bits | 4 Bits | 4 Bits | 4 Bits |
I-Long Format
| Opcode | RS | Immediate |
|---|---|---|
| 4 Bits | 4 Bits | 8 Bits |
J-Format
| Opcode | Immediate |
|---|---|
| 4 Bits | 12 Bits |
Instruction Set
| Instruction | Mnemonic | Operation | Opcode | Format |
|---|---|---|---|---|
| Add Immediate | addi | addi $s1, $s2, 100; $s1 = $s2 + 100 | 0000 | I |
| Add | add | add $s1, $s2, $s3; $s1 = $s2 + $s3 | 0001 | R |
| Load Upper Immediate | lui | lui $s1, 0xF; $s1 = 0xF0 | 0010 | I-Long |
| Load Word | lw | lw $s0, 2($s1); $s0 = Mem[$s1 + 2] | 0011 | I |
| Store Word | sw | sw $s0, 2($s1); Mem[$s1 + 2] = $s0 | 0100 | I |
| Shift Left Logical | sll | sll $s0, $s1, 2; $s0 = $s1 << 2 | 0101 | I |
| Arithmetic Shift Right | asr | asr $s0, $s1, 2; $s0 = $s1 >> 2 (Operation preserves sign) | 0110 | I |
| Xor | xor | xor $s1, $s2, $s3; $s1 = $s2 ⊕ $s3 | 0111 | R |
| Or | or | $s3 | 1000 | R |
| Branch on Less Than | ble | ble $s0, $s1, location; if $s0 < $s1, goto location + offset. Else, goto next statement | 1001 | I |
| Unconditional Jump | j | j location; goto address of location | 1010 | J |
| Plus Equals | pe | pe $s0, 16; $s0 = $s0 + 16 | 1011 | I-Long |
| Plus Equals Unsigned | peu | peu $s0, 255; $s0 = $s0 + 255 | 1100 | I-Long |
| Jump on Zero Bit | jz | jz location; If zero flag is set, goto address of location | 1101 | J |
| Logical Shift Right | lsr | lsr $s0, $s1, 2; $s0 = $s1 >> 2 (Does not preserve sign) | 1110 | I |
| No Operation | nop | Nothing Happens | 1111 | R |
Assembly Language Code
# addi $v0 $zero 64 # $v0 = 0040hex;.
add $v0 $zero $zero
pe $v0 64
lui $v1 16 # $v1 = 1010hex;
# addi $v1 $v1 16
add $v1 $zero $zero
pe $v1 16
#addi $v2 $zero 15 # $v2 = 000Fhex;
add $v2 $zero $zero
pe $v2 15
# addi $v3 $zero 240 # $v3 = 00F0hex;
add $v3 $zero $zero
peu $v3 240
add $t0 $zero $zero # $t0 = 0000hex;
# addi $a0 $zero 16 # $a0 = 0010hex;
add $a0 $zero $zero
pe $a0 16
addi $a1 $zero 5 # $a1 = 0005hex;
#Temporary registers to store values for comparisons and assignments
lui $t2 1 # Compare Val for: if ($t0 > 0100hex) then {
lui $t3 255 # Store val for: Mem[$a0] = FF00hex;
# addi $t4 255 # Store val for: Mem[$a0] = 00FFhex;
addi $t4 $zero $zero
peu $t4 255
checkLoop:
ble $a1 $zero exitWhileShort nop j beginWhile nop
exitWhileShort:
j exitWhile nop
beginWhile:
addi $a1 $ai -1 # $a1 = $a1 - 1; lw $t0 0($a0) # $t0 = Mem[$a0]; ble $t0 $t2 beginElse # if ($t0 > 0100hex) nop asr $v0 $v0 3 # $v0 = $v0 / 8; or $v1 $v1 $v0 # $v1 = $v1 | $v0; sw $t3 0($a0) # Mem[$a0] = FF00hex; j skipElse nop
beginElse:
sll $v2 $v2 2 # $v2 = $v2 * 4; xor $v3 $v3 $v2 # $v3 = $v3 xor $v2; sw $t4 0($a0) # Mem[$a0] = 00FFhex;
skipElse:
addi $a0 $a0 2 # $a0 = $a0 + 2; j checkLoop nop
exitWhile:
Machine Language Code
| # | Assembly Language | Machine Code | Hex |
|---|---|---|---|
| 0 | add $v0 $zero $zero | 0001 0001 0000 0000 | 0x1100 |
| 1 | pe $v0 64 | 1011 0001 01000000 | 0xB140 |
| 2 | lui $v1 16 | 0010 0010 00010000 | 0x2210 |
| 3 | add $v1 $zero $zero | 0001 0010 0000 0000 | 0x1200 |
| 4 | pe $v1 16 | 1011 0010 0001000 | 0xB210 |
| 5 | add $v2 $zero $zero | 0001 0011 0000 0000 | 0x1300 |
| 6 | pe $v2 15 | 1011 0011 00001111 | 0xB30F |
| 7 | add $v3 $zero $zero | 0001 0100 0000 0000 | 0x1400 |
| 8 | peu $v3 240 | 1100 0100 11110000 | 0xC4F0 |
| 9 | add $t0 $zero $zero | 0001 0101 0000 0000 | 0x1500 |
| 10 | add $a0 $zero $zero | 0001 1010 0000 0000 | 0x1A00 |
| 11 | pe $a0 16 | 1011 1010 00010000 | 0xBA10 |
| 12 | addi $a1 $zero 5 | 0000 1011 0000 0101 | 0x0B05 |
| 13 | lui $t2 1 | 0010 0111 00000001 | 0x2701 |
| 14 | lui $t3 255 | 0010 1000 11111111 | 0x28FF |
| 15 | addi $t4 $zero $zero | 0000 1001 0000 0000 | 0x0900 |
| 16 | peu $t4 255 | 1100 1001 11111111 | 0xC9FF |
| 17 | ble $a1 $zero exitWhileShort (exitWhileShort is 4 memory locations from the current instruction) | 1001 1011 0000 0011 | 0x9B03 |
| 18 | nop | 1111 1111 1111 1111 | 0xFFFF |
| 19 | j BeginWhile | 1010 000000000011 | 0xA003 |
| 20 | nop | 1111 1111 1111 1111 | 0xFFFF |
| 21 | j exitWhile | 1010 000000001111 | 0xA00F |
| 22 | nop | 1111 1111 1111 1111 | 0xFFFF |
| 23 | addi $a1 $a1 -1 | 0000 1011 1011 1111 | 0x0BBF |
| 24 | lw $t0 0($a0) | 0011 0101 1010 0000 | 0x35A0 |
| 25 | ble $t0 $t2 beginElse ( beginElse is 7 memory locations from the current instructions) | 1001 0101 0111 0110 | 0x9576 |
| 26 | nop | 1111 1111 1111 1111 | 0xFFFF |
| 27 | asr $v0 $v0 3 | 0110 0001 0001 0011 | 0x6113 |
| 28 | or $v1 $v1 $v0 | 1000 0010 0010 0001 | 0x8221 |
| 29 | sw $t3 0($a0) | 0100 1000 1010 0000 | 0x48A0 |
| 30 | j skipElse (skipElse is at memory location 35) | 1010 000000100100 | 0xA004 |
| 31 | nop | 1111 1111 1111 1111 | 0xFFFF |
| 32 | sll $v2 $v2 2 | 0101 0011 0011 0010 | 0x5332 |
| 33 | Xor $v3 $v3 $v2 | 0111 0100 0100 0011 | 0x7443 |
| 34 | sw $t4 0($a0) | 0100 1001 1010 0000 | 0x49A0 |
| 35 | addi $a0 $a0 2 | 0000 1010 1010 0010 | 0x0AA2 |
| 36 | j checkLoop (checkLoop is at memory location 17) | 1010 111111101100 | 0xAFEC |
| 37 | nop | 1111 1111 1111 1111 | 0xFFFF |
Responsibilities
| Name | Responsibilities |
|---|---|
| Richard Corey | ID/EX Stages |
| Jaron Martin | ED/MEM Stages |
| Sam Shannon | MEM/WB Stages |
| All Members | Web Design/Presentation |
Meetings
| Meeting | Work |
|---|---|
| Week 1 (March 22 - April 2) | Design and create design documents including all diagrams |
| Week 2 (April 3 - April 9) | General Programming on assigned portions |
| Week 3 (April 10 - April 16) | Completion of programming and beginning of testing |
| Week 4 (April 17 - April 21) | Final testing and Demo preparation |
| April 21 | Demonstration |
Progress
Divided the project by stages, begun individual work on each stage.
4/11/2011
- Finished Control Unit Module Table
- Finished Control Unit
- Finished Forwarding Module
- Further progress on individual stages
| Name | Mnemonic | ALUOp | I-Long | ALUSrc | Branch | Mem-Read | Mem-Write | Reg-Write | Mem-to-Reg |
|---|---|---|---|---|---|---|---|---|---|
| Add Immediate | Addi | 000 | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
| Add | Add | 000 | X | 0 | 0 | 0 | 0 | 1 | 0 |
| Load Upper Immediate | Lui | 001 | 1 | 1 | 0 | 0 | 0 | 1 | 0 |
| Load Word | lw | 000 | 0 | 1 | 0 | 1 | 0 | 1 | 1 |
| Store Word | sw | 000 | 0 | 1 | 0 | 0 | 1 | 1 | 0 |
| Shift Left Logical | sll | 010 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
| Arithmetic Shift Right | Asr | 011 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
| Xor | Xor | 100 | X | 0 | 0 | 0 | 0 | 1 | 0 |
| Or | Or | 101 | X | 0 | 0 | 0 | 0 | 1 | 0 |
| Branch on Less Than or Equal To | Ble | 110 | 0 | 1 | 1 | 0 | 0 | 0 | X |
| Unconditional Jump | j | X | X | X | 1 | 0 | 0 | 0 | X |
| Plus Equals | Pe | 000 | 1 | 0 | 0 | 0 | 0 | 1 | 0 |
| Plus Equals Unsigned | Peu | 000 | 1 | 0 | 0 | 0 | 0 | 1 | 0 |
| Logical Shift Right | Lsr | 111 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |
| No Operation | Nop | X | X | X | 0 | 0 | 0 | 0 | X |




