-
chiplab里的icache dcache和cache interface
lsoc1000_mainpipe里的inst_和data_这两个inteface分别和mycpu_top外面的icache dcache通信。 同时icache dcache模块还有接口和core_top里的ram_wrapper通信。 ram_wrapper是cache的实现。 icache和dcache还和cache_interface通信,cache_interface通过AXI协议与core_top外面的axi slave通信获取内存中的数据。 这里内存即可以是通过memory controller取得的ddr内存的数据,也可以是chiplab里用的sram。 core_top外面是soc_top,在chip/soc_demo/sim/soc_top.v里。 这里面的东西在以前的blog里写过了。 soc_top soc_top +—————————————————————————————————————————————————————————————————————————————————————-+ | core_top | | | | | | +————————————————————————————————————————————————————————–+ | | | mycpu_top | | | | | | | | | | | | +——————————————–+ | | | | | icache | | | |...
-
inst memory interface里的inst_cancel信号
这个信号过了很久就忘了干什么用的了。 等以后自己写cache了就能换掉这些icache dcache的memory interface了。 188 // when branch taken, inst_cancel need to be signal 189 // so that the new target instruction can be fetched instead of the one previously requested 190 assign inst_cancel = br_taken; 当跳转发生的时候signal inst_cancel,就是下面这样,取指令的时间更久了。 但如果去掉这句,不signal inst_cancel,就是下面这样。 取指令时间没有变,但取出来的指令并不是跳转以后的新地址处的指令,而是跳转指令顺序下一条的指令。 还是之前发处的取值指令。 obj/main.elf: file format elf32-loongarch obj/main.elf Disassembly of section...
-
branch指令里的jirl
jirl主要就是把pc+4的值存到rd寄存器里,而且寻址也不是pc+offs,而是[rj]+offs。 在实现上,就相当于branch指令和ALU指令的结合。 既需要跳转,又需要算出地址并写回到rd指定的寄存器里。 526 wire rddata_sel_alu_res_m_l; 527 wire rddata_sel_lsu_res_m_l; 528 wire rddata_sel_bru_res_m_l; 529 530 assign rddata_sel_alu_res_m_l = (lsu_ecl_rdata_valid_m | bru_wen_m); // default is alu resulst if no other module claims it 531 assign rddata_sel_lsu_res_m_l = ~lsu_ecl_rdata_valid_m; 532 assign rddata_sel_bru_res_m_l = ~bru_wen_m; 533 534 dp_mux3ds #(`GRLEN) rd_data_mux(.dout (rd_data_m), 535 .in0 (alu_ecl_res_m),...