MIPS Registers
.data
n: .word
p: .word
q: .word
r: .word
s: .word
t: .word
u: .word
v: .word
w: .word
x: .word
y: .word
z: .word
str:
.asciiz
"hello
world\n"
R0 (r0):
0x00000000
R1 (at):
0x10010000
R2 (v0):
0x00000000
R3 (v1):
0x0000000c
R4 (a0):
0x00000023
R5 (a1):
0x10010010
R6 (a2):
0x0000000a
R7 (a3):
0x00000050
R8 (t0):
0x00000000
R9 (t1):
0x0000ffff
R10 (t2):
0x00000000
R11 (t3):
0x10010020
R12 (t4):
0x10010030
R13 (t5):
0x10010020
R14 (t6):
0x80000010
R15 (t7):
0xffff0000
R16 (s0):
0xff00ff00
R17 (s1):
0x00000000
R18 (s2):
0x00000023
R19 (s3):
0x10010000
R20 (s4):
0x00400020
R21 (s5):
0x00000000
R22 (s6):
0x800c1001
R23 (s7):
0x00000010
R24 (t8):
0x00000000
R25 (t9):
0x00000000
R26 (k0):
0x00000000
R27 (k1):
0x00000000
R28 (gp):
0x10008000
R29 (sp):
0x7fffeff0
R30 (s8):
0x00000000
R31 (ra):
0x00400060
Data
[0x10000000]...[0x1000fffc] 0x00000000
[0x10010000] 0x5350494d 0x20697320
[0x10010010] 0x2073696d 0x756c6174
[0x10010020] 0x6561726e 0x5350494d
[0x10010030] 0x68656c6c 0x6f20776f
[0x10010040] 0x726f6772 0x00000000
[0x10010050] 0xf7f7f7f7 0xf7f7f7f7
[0x10010060]...[0x10020000] 0x00000000
0x61207573
0x6f722066
0x4d495053
0x726c640a
0x00000000
0xf7f7f7f7
0x6566756c
0x6f72206c
0x20617373
0x00000000
0x6e642063
0xf7f7f7f7
Use the data declaration, SPIM memory dump, and MIPS register readouts above as
directed in the problems starting on the following page. Note: If a register or memory
location is changed in any problem, the change DOES NOT CARRY OVER to another
problem!
1. After: lw $t0, w, what are the contents of $t0?
0x 6561 726e
0x ff00 ff00
0x 1001 0020
0x 6f72 206c
4. After: srl $t0, $ra, 12, what are the contents of $t0?
0x 0000 0400
5. After: sra $t0, $s6, 16, what are the contents of $t0?
0x ffff 800c
6. After: rol $t0, $t7, 20, what are the contents of $t0?
0x 000f fff0
7. After: lw $t6, 16($t4); ror $t6, $t6, 16, what are the contents of $t6? 0x 6772 726f
8. After completion of: jr $s4, what are the contents of the PC? 0x 0040 0020 (or 24)
9. After: ror $t0, $sp, 14; sra $t0, $t0, 6 what are the contents of $t0?
0x feff 07ff
10. After: lw $t0, w; lw $t1, x; slt $t2, $t1, $t0 what is in $t2?
1____
1____
Yes___
No
.data
data1: .space 4
#
.text
main: li $v0, 1
syscall
sw $v0, data1
move $a0, $v0
li $v0, 4
syscall
done: li $v0,10
syscall
(1)
(2)
.data
data1: .word 0
data2: .word 0
.text
main: lw $t0, data1
mul $t0, $t0, $t0
bgt $t0, 0xffff, zero
blt $t0, 0xff, zero
sw $t0, data2
j done
zero:
done:
char:
main:
over:
sw $0, data2
j go
.data
.space 1
.text
lb $t0, char
seq $t1, $t0, 0x61
bnez $t1, over
sb $t1, char
j done
.text
main: la $t0,str
go:
lb $t1,($t0)
beqz $t1,print
beq $t1,0x20,nxt
beq $t1,0x0a,nxt
sub $t1,$t1,0x20
sb $t1,($t0)
nxt:
addi $t0,$t0,1
j go
print:
str:
la $a0,str
li $v0,4
syscall
li $v0,10
syscall
.data
.asciiz hello world\n
R8 (t0):
0x00000000
R9 (t1):
0x0000ffff
R10 (t2):
0x00000000
R11 (t3):
0x10010020
R12 (t4):
0x10010030
R13 (t5):
0x10010020
R14 (t6):
0x80000010
R15 (t7):
0xffff0000
R16 (s0):
0xff00ff00
R17 (s1):
0xff03f77a
R18 (s2):
0x00000023
R19 (s3):
0x10010000
R20 (s4):
0x00400020
R21 (s5):
0x000000ff
R22 (s6):
0x800c1001
R23 (s7):
0x00000010
R24 (t8):
0x00000000
R25 (t9):
0x00000000
R26 (k0):
0x00000000
R27 (k1):
0x00000000
R28 (gp):
0x10008000
R29 (sp):
0x7fffeff0
R30 (fp):
0x00000000
R31 (ra):
0x00400060
Data Memory
[0x10010000]
[0x10010010]
[0x10010020]
[0x10010030]
[0x10010040]
[0x10010050]
0x5350494d
0x2073696d
0xc561726e
0x00000000
0x726f6772
0xf7f7f7f7
0x20697320
0x756c6174
0x9350494d
0x00000000
0x80f9000b
0xf7f7f7f7
0x61207573
0x6f722066
0x4d495033
0x00000000
0xfef00006
0xf7f7f7f7
0x6566756c
0x6f72206c
0x20617373
0x00000000
0x00000000
0xf7f7f7f7
.text
main: la $t0,s
loop: lw $a0,($t0)
beqz $a0,done
bgtz $a0,add1
li $v0,1
syscall
add1: addi $t0,$t0,4
j loop
done: li $v0,10
syscall
-- Encountering a 0.
-- Two.
Sequential Logic
19. The counter below counts in an unusual cycle, so simply finding m-1 wont help you in this case.
Using the K-maps and count charty, find the Boolean expressions for Ty and Tx (clearly, Tz = 1).
With those, you can determine the Ts at count 0, then let the clock tick. You can then determine the
Ts at count 1 and repeat, etc. using this method, you can find the count cycle. You will eventually
discover some dont cares.
yz
Ty
x
00
0 0
01
0
1 1
11
0
0X 1X
Ty xz yz
and
yz
Tx
10
1
Tx y z
x
0
1
1
0
0
0
0
Etc.
00
0 1
01
0
1 1
11
0
y
0
0
0
1
1
0
0
Count
z Tx Ty
0
1
0
1
0
0
0
0
1
1
0
0
0
1
1
1
0
0
0
1
0
Tz
1
1
1
1
1
1
1
10
0
0
0X
X
20. Develop a timing diagram for the MUX on the chart shown below. Plot the timing of FFs x, y, and z,
and also the MUX Out signal.
"1"
T
z
C
y
C
x
C
MUX Out
Reset
Clock
Actual
Counting
Cycle
A
B
MUX Out
Stage x
Stage y
Stage z
Clock
10
11
12
13
14
Actual
1
Counting
Cycle