UART
Module 3 Review
Christopher Mar
Data Copying
Store word
Register to memory (== storage)
Load word
Memory to register
Move
Register to register
UART
Receiving:
21 bit position (0b10) uses:
Command register (0xf0000000)
Clear status bit (tell UART to get next character)
Status register (0xf0000004)
Ready bit (indicates UART has new character in receive buffer)
Receive buffer (0xf0000008)
Inequalities
slt $t3, $t1, $t2
If $t1 < $t2 then $t3 set to 1 (true)
Else $t3 set to 0 (false)
Inequalities
Inequality Instruction R if inequality is true
A < B slt R, A, B 1
A >= B slt R, A, B 0
A > B slt R, B, A 1
A <= B slt R, B, A 0
Stack
Typical initialization:
li $sp, 0x10FFFFFC
Pseudo-ops
push $__
Decrement $sp and write to stack
pop $__
Read from stack and increment $sp
Arrays
Label placed above assembler directive allocating space used as pointer
li $s0, label_used_as_pointer
For 1-word array elements, add 4 bytes to move pointer register to next element
Subtract 4 for previous element
Function Calls
No context saving:
jal function_label (jump-and-link) to “call”
jr (jump register) to “return”
Save register values to stack:
call function_label
return
Watcher Window
While in simulation mode, click the magnifying glass
Breakpoints
While in simulation mode, double-clicking to the right of a line number with an instruction adds a breakpoint
Memory Visualizer
While in simulation mode, click simulation, then tools and select Create a PLP CPU Memory Visualizer
Q & A