生成新的register file
abstraction for all registers and some muxing
读写也在此处发生
step 4
此处用到ALU来处理运算
怎么确定该运行哪个操作?—— ALUSelect
step 5
把 ALU 的输出送去 regfile,写入新数据
I-type
Imm Gen 生成 immediate
ALU前面加BSel,区分R type, I type
DMEM
For load instructions, DMEM
input: address
output: 32 bit value
(Load instruction will use every component)
control refresher
ALUSel: to perform which operation?
RWEn: write back to register?
BSel: R type or I type?
ImmSel: how to reassemble the immediate?
MemRW: read from memory or write to it?
WBSel: write back to destination register the ALU output or DMEM output?
CPU
课程教材中的某张图很好,形象简述了CPU内部构造是怎样的
Datapath
RISC-V CPU处理以下几种常见运算 先从简单的下手,构造 R type 运算 e.g. add t0, t0, t2
运算五步走:
接着是一步步详细讲
step 1
IMEM从PC获取指令地址,输出指令 R type instructions, 运行完毕,PC就会去到下一个指令
step 2
从IMEM取出instruction bits
inst[11:7] inst[19:15] inst[24:20] 分别对应 rd, rs1, rs2 (这一步也决定了我们要操作的registers和要使用的内存大小)
step 3
生成新的register file
abstraction for all registers and some muxing
读写也在此处发生
step 4
此处用到ALU来处理运算
怎么确定该运行哪个操作?—— ALUSelect
step 5
把 ALU 的输出送去 regfile,写入新数据
I-type
Imm Gen 生成 immediate
ALU前面加BSel,区分R type, I type
DMEM
For load instructions, DMEM
input: address
output: 32 bit value
(Load instruction will use every component)
control refresher
ALUSel: to perform which operation?
RWEn: write back to register?
BSel: R type or I type?
ImmSel: how to reassemble the immediate?
MemRW: read from memory or write to it?
WBSel: write back to destination register the ALU output or DMEM output?