-
chiplab里的csr
// csrrd/wr/xchg output [`GRLEN-2 :0] rdata, <--- input [`LSOC1K_CSR_BIT-1:0] raddr, input [`GRLEN-1 :0] wdata, input [`LSOC1K_CSR_BIT-1:0] waddr, input wen , 这有个bug,rdata长度是31bit。 可能因为很少csr寄存器用到第31bit吧,不容易发现。 csr寄存器是这样实现的。 // CRMD 0x0_0_0 reg [1:0] crmd_plv; reg crmd_ie; reg crmd_da; reg crmd_pg; reg [1:0] crmd_datf; reg [1:0] crmd_datm; reg crmd_we; assign crmd = { `ifdef GS264C_64BIT 32'b0,...
-
mul指令
LoongArch32上只有mul.w mulh.w mulh.wu这三条。 mul64x64模块试了下,下一个周期就能返回结果。 比如mul.w,试了下2 x 2和-1 x -1。 又试了下mulhwu,结果对,也是下个周期就返回。 其实就可以把这个结果按_m返回直接丢给rd_data_mux了。 网上搜了下,说mul指令是可以一个周期完成的,就是快就需要很多full adder,在以前的话比较费资源。 不过我还没时间好好学习这部分,直接用了chiplab里的mul64x64模块,连接口也没改。 1 module mul64x64( 2 input clk, 3 input rstn, 4 5 input mul_validin, 6 input ex2_allowin, 7 output mul_validout, 8 input ex1_readygo, 9 input ex2_readygo, 10 11 input [63:0] opa, 12 input [63:0] opb, 13 input...
-
exu_ifu_stall_req
exu_ifu_stall_req This signal stalls the IFU from fetching next instruction and the pc_f remains. When executing a load instruction, the pipeline need to be stalled until it retrives data. assign fdp_dec_valid = inst_valid & ~exu_ifu_stall_req & ~br_taken; exu_ifu_stall_req should contains br_taken. Turns out, br_taken better not mess with exu_ifu_stall_req because...