@@ -328,6 +328,20 @@ riscv_dmem_out_t riscv_dmem(
328328 riscv_dmem_ram_out_t ram_out = riscv_dmem_ram (mem_rw_word_index ,
329329 wr_word , wr_word_byte_ens , 1 );
330330 uint32_t mem_rd_data = ram_out .rd_data0 ;
331+ #ifdef RISCV_DMEM_1_CYCLE
332+ // Manually delay signals to align with 1 cycle read data delay of dmem
333+ #ifdef RISCV_DMEM_NO_AUTOPIPELINE
334+ static riscv_mmio_mod_out_t mem_map_out_reg ;
335+ static uint2_t byte_mux_sel_reg ;
336+ static uint1_t rd_byte_ens_reg [4 ];
337+ riscv_mmio_mod_out_t mem_map_out_next = mem_map_out ;
338+ uint2_t byte_mux_sel_next = byte_mux_sel ;
339+ uint1_t rd_byte_ens_next [4 ] = rd_byte_ens ;
340+ mem_map_out = mem_map_out_reg ;
341+ byte_mux_sel = byte_mux_sel_reg ;
342+ rd_byte_ens = rd_byte_ens_reg ;
343+ #endif
344+ #endif
331345
332346 // Determine output memory read data
333347 // Mem map read comes from memory map module not RAM memory
@@ -356,5 +370,14 @@ riscv_dmem_out_t riscv_dmem(
356370 // Final mem rd data assignment to output
357371 mem_out .rd_data = mem_rd_data ;
358372
373+ // Manual pipeline regs next signal
374+ #ifdef RISCV_DMEM_1_CYCLE
375+ #ifdef RISCV_DMEM_NO_AUTOPIPELINE
376+ mem_map_out_reg = mem_map_out_next ;
377+ byte_mux_sel_reg = byte_mux_sel_next ;
378+ rd_byte_ens_reg = rd_byte_ens_next ;
379+ #endif
380+ #endif
381+
359382 return mem_out ;
360383}
0 commit comments