Lecture 9 RISC-V Decision Making and Logical Operations¶
Branches¶
Text Only | |
---|---|
1 2 |
|
Text Only | |
---|---|
1 2 |
|
Text Only | |
---|---|
1 2 |
|
Text Only | |
---|---|
1 2 |
|
Text Only | |
---|---|
1 2 |
|
Text Only | |
---|---|
1 2 |
|
Loop¶
C | |
---|---|
1 2 3 |
|
C | |
---|---|
1 2 3 |
|
C | |
---|---|
1 2 3 4 |
|
Logical Instructions¶
and¶
and / andi
Text Only | |
---|---|
1 2 3 4 5 6 7 |
|
Not (X)¶
There is no logical NOT in RISC-V
Use
xor
with \(11111111_{two}\)
Logical Shifting¶
Left Shifting (0 complement)¶
sll / slli
Shift Left Logical (sll
) and immediate (slli
):
Text Only | |
---|---|
1 |
|
Store in x11
the value from x12
shifted by 2 bits to the left (they fall off end), inserting 0’s on right; << in C.
Right Shifting¶
Complete with 0
srl / srli
Shift Right Logical (srl
) and immediate (srli
):
Complete with signal bit
sra / srai
Shift Right Logical (sra
) and immediate (srai
):
Program Execution¶
Symbolic register names
a0 - a7
for argument registers (x10 - x17
) for function callszero
forx0
Pseudo - instructions
Shorthand syntax for common assembly idioms
Text Only | |
---|---|
1 2 3 |
|