Lec-31-32 EE-222
Lec-31-32 EE-222
SYSTEMS
EE-222
RISC-V Assembly
Data Transfer Instructions
DATA TRANSFER INSTRUCTIONS
Store (to)
Datapath Output
Registers Load (from)
DATA TRANSFER
msb 00 00 01 80 lsb
UNSIGNED INSTRUCTIONS
C code:
if (i==j) f = g+h;
else f = g-h;
f, g, … in x19, x20, …
Compiled RISC-V code:
bne x22, x23, Else
add x19, x20, x21
beq x0,x0,Exit // unconditional
Else: sub x19, x20, x21
Exit: …
Assembler calculates addresses
BREAKING DOWN THE IF ELSE
• Example
• The slides in this lecture contain materials and illustrations developed and
copyright by:
• Prof. David A. Patterson and Prof. John L. Hennessy [UC Berkely]
• Prof. Onur Mutlu [ETH Zurich]
• Steven Ho and Nick Riasanovsky[UC Berkely]
• Arvind (MIT)
• Krste Asanovic (MIT/UCB)
• Joel Emer (Intel/MIT)
• James Hoe (CMU)
• John Kubiatowicz (UCB)
• Lavanya Ramapantulu (NTU)
THANK YOU