Professional Documents
Culture Documents
Rv32i Timing
Rv32i Timing
pc clk
pc alu sel +4
lui x15,0x8 auipc x2,0x12345 addi x1,x2,10 srai x20,x15,2 add x1,x2,x15 sub x1,x20,x2
CLK
insn[6..0] opcode = 0x37 opcode = 0x17 opcode = 0x13 opcode = 0x13 opcode = 0x33 opcode = 0x33
rd 15 2 1 20 1 1
pc clk
pc alu sel +4
insn clk
insn 0x000087b7 0x12345117 0x00a10093 0x4027da13 0x00f100b3 0x402a00b3
rs1 2 15 2 20
rs2 15 2
addr sel pc
Figure 2: Fetch and decode cycles of U-type, R-type, and some I-type instructions.
©
Copyright 2019, 2020 John Winans. All Rights Reserved
~/NIU/courses/463/2020-fa/notes/rv32i control fsm/timing.tex
Page 1 of 3
lui x15,0x8 auipc x2,0x12345 addi x1,x2,10 srai x20,x15,2 add x1,x2,x15 sub x1,x20,x2
CLK
EQ
A<B
A<UB
insn[6..0] opcode = 0x37 opcode = 0x17 opcode = 0x13 opcode = 0x13 opcode = 0x33 opcode = 0x33
rd clk
rd sel 1 = alu 1 = alu 1 = alu 1 = alu 1 = alu 1 = alu
rd 15 2 1 20 1 1
pc clk
pc alu sel +4
insn clk
insn 0x000087b7 0x12345117 0x00a10093 0x4027da13 0x00f100b3 0x402a00b3
rs1 2 15 2 20
rs2 15 2
sub sra add srl sub sra add srl sub sra
mem clk
addr sel pc
sx size[2..0]
mem sx
t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13
Figure 3: Fetch, decode, and execute cycles of U-type, R-type, and some I-type instructions.
©
Copyright 2019, 2020 John Winans. All Rights Reserved
~/NIU/courses/463/2020-fa/notes/rv32i control fsm/timing.tex
Page 2 of 3
jwinans@niu.edu 2020-10-21 17:36:56 -0500 v2.0-760-ga9a2e50
00000018: 0027a423 sw x2,8(x15) // m32(0x00008000 + 0x00000008) = 0x12345004
0000001c: 0087a803 lw x16,8(x15) // x16 = sx(m32(0x00008000 + 0x00000008)) = 0x12345004
00000020: 008000ef jal x1,0x28 // x1 = 0x00000024, pc = 0x00000020 + 0x00000008 = 0x00000028
00000028: 03000267 jalr x4,48(x0) // x4 = 0x0000002c, pc = (0x00000030 + 0x00000000) & 0xfffffffe = 0x00000030
sw x2,8(x15) lw x16,8(x15) jal x1,0x28 jalr x4,48(x0) beq x0,x15,0x50 beq x2,x16,0x54
CLK
EQ
A<B
A<UB
insn[6..0] opcode = 0x23 opcode = 0x03 opcode = 0x6f opcode = 0x67 opcode = 0x63 opcode = 0x63
insn[30]
rd clk
rd sel 1 = mem sx 3 = pc alu 3 = pc alu
rd 16 1 4
pc clk
pc alu sel +4 +imm x
insn clk
insn 0x0027a423 0x0087a803 0x008000ef 0x03000267 0x02f00063 0x03010063
rs1 15 15 0 0 2
rs2 2 15 16
mem clk
addr sel pc alu pc alu pc
sx size[2..0] 0
mem sx 0x12345004
Figure 4: Fetch, decode, and execute of load, store, jump, and branch instructions.
©
Copyright 2019, 2020 John Winans. All Rights Reserved
~/NIU/courses/463/2020-fa/notes/rv32i control fsm/timing.tex
Page 3 of 3
jwinans@niu.edu 2020-10-21 17:36:56 -0500 v2.0-760-ga9a2e50