Merge branch 'tempMain' into main

This commit is contained in:
Ross Thompson 2022-09-20 13:57:38 -05:00
commit c73fae8a96
8 changed files with 22 additions and 18 deletions

View File

@ -45,6 +45,7 @@ module bram1p1rw
//---------------------------------------------------------------------- //----------------------------------------------------------------------
) ( ) (
input logic clk, input logic clk,
input logic ce,
input logic we, input logic we,
input logic [NUM_COL-1:0] bwe, input logic [NUM_COL-1:0] bwe,
input logic [ADDR_WIDTH-1:0] addr, input logic [ADDR_WIDTH-1:0] addr,
@ -105,6 +106,7 @@ end
always @ (posedge clk) begin always @ (posedge clk) begin
if(ce) begin
dout <= RAM[addr]; dout <= RAM[addr];
if(we) begin if(we) begin
for(i=0;i<NUM_COL;i=i+1) begin for(i=0;i<NUM_COL;i=i+1) begin
@ -114,4 +116,5 @@ end
end end
end end
end end
end
endmodule // bytewrite_tdp_ram_rf endmodule // bytewrite_tdp_ram_rf

View File

@ -41,6 +41,7 @@ module brom1p1r
//---------------------------------------------------------------------- //----------------------------------------------------------------------
) ( ) (
input logic clk, input logic clk,
input logic ce,
input logic [ADDR_WIDTH-1:0] addr, input logic [ADDR_WIDTH-1:0] addr,
output logic [DATA_WIDTH-1:0] dout output logic [DATA_WIDTH-1:0] dout
); );
@ -48,7 +49,7 @@ module brom1p1r
logic [DATA_WIDTH-1:0] ROM [(2**ADDR_WIDTH)-1:0]; logic [DATA_WIDTH-1:0] ROM [(2**ADDR_WIDTH)-1:0];
always @ (posedge clk) begin always @ (posedge clk) begin
dout <= ROM[addr]; if(ce) dout <= ROM[addr];
end end
if(PRELOAD_ENABLED) begin if(PRELOAD_ENABLED) begin

View File

@ -189,11 +189,11 @@ module ifu (
logic [`PA_BITS-1:0] IROMAdr; logic [`PA_BITS-1:0] IROMAdr;
logic IROMAccessRW; logic IROMAccessRW;
/* verilator lint_off WIDTH */ /* verilator lint_off WIDTH */
assign IROMAdr = CPUBusy | reset ? PCFSpill : PCNextFSpill; // zero extend or contract to PA_BITS assign IROMAdr = reset ? PCFSpill : PCNextFSpill; // zero extend or contract to PA_BITS
/* verilator lint_on WIDTH */ /* verilator lint_on WIDTH */
assign RWF = 2'b10; assign RWF = 2'b10;
irom irom(.clk, .reset, .Adr(CPUBusy | reset ? PCFSpill : PCNextFSpill), .ReadData(FinalInstrRawF)); irom irom(.clk, .reset, .ce(~CPUBusy), .Adr(CPUBusy | reset ? PCFSpill : PCNextFSpill), .ReadData(FinalInstrRawF));
end else begin end else begin
assign RWF = 2'b10; assign RWF = 2'b10;

View File

@ -30,7 +30,7 @@
`include "wally-config.vh" `include "wally-config.vh"
module irom( module irom(
input logic clk, reset, input logic clk, reset, ce,
input logic [`XLEN-1:0] Adr, input logic [`XLEN-1:0] Adr,
output logic [31:0] ReadData output logic [31:0] ReadData
); );
@ -38,6 +38,6 @@ module irom(
localparam ADDR_WDITH = $clog2(`IROM_RANGE/8); localparam ADDR_WDITH = $clog2(`IROM_RANGE/8);
localparam OFFSET = $clog2(`LLEN/8); localparam OFFSET = $clog2(`LLEN/8);
brom1p1r #(ADDR_WDITH, 32) rom(.clk, .addr(Adr[ADDR_WDITH+OFFSET-1:OFFSET]), .dout(ReadData)); brom1p1r #(ADDR_WDITH, 32) rom(.clk, .ce, .addr(Adr[ADDR_WDITH+OFFSET-1:OFFSET]), .dout(ReadData));
endmodule endmodule

View File

@ -30,7 +30,7 @@
`include "wally-config.vh" `include "wally-config.vh"
module dtim( module dtim(
input logic clk, reset, input logic clk, reset, ce,
input logic [1:0] MemRWM, input logic [1:0] MemRWM,
input logic [`PA_BITS-1:0] Adr, input logic [`PA_BITS-1:0] Adr,
input logic TrapM, input logic TrapM,
@ -47,6 +47,6 @@ module dtim(
assign we = MemRWM[0] & ~TrapM; // have to ignore write if Trap. assign we = MemRWM[0] & ~TrapM; // have to ignore write if Trap.
bram1p1rw #(`LLEN/8, 8, ADDR_WDITH) bram1p1rw #(`LLEN/8, 8, ADDR_WDITH)
ram(.clk, .we, .bwe(ByteMaskM), .addr(Adr[ADDR_WDITH+OFFSET-1:OFFSET]), .dout(ReadDataWordM), .din(WriteDataM)); ram(.clk, .ce, .we, .bwe(ByteMaskM), .addr(Adr[ADDR_WDITH+OFFSET-1:OFFSET]), .dout(ReadDataWordM), .din(WriteDataM));
endmodule endmodule

View File

@ -212,12 +212,12 @@ module lsu (
// The DTIM uses untranslated addresses, so it is not compatible with virtual memory. // The DTIM uses untranslated addresses, so it is not compatible with virtual memory.
// Don't perform size checking on DTIM // Don't perform size checking on DTIM
/* verilator lint_off WIDTH */ /* verilator lint_off WIDTH */
assign MemStage = CPUBusy | MemRWM[0] | reset; // 1 = M stage; 0 = E stage assign MemStage = MemRWM[0] | reset; // 1 = M stage; 0 = E stage
assign DTIMAdr = MemStage ? IEUAdrExtM : IEUAdrExtE; // zero extend or contract to PA_BITS assign DTIMAdr = MemStage ? IEUAdrExtM : IEUAdrExtE; // zero extend or contract to PA_BITS
/* verilator lint_on WIDTH */ /* verilator lint_on WIDTH */
// *** add ce to bram1... to remove this extra mux control. // *** add ce to bram1... to remove this extra mux control.
dtim dtim(.clk, .reset, .MemRWM, dtim dtim(.clk, .reset, .ce(~CPUBusy), .MemRWM,
.Adr(DTIMAdr), .Adr(DTIMAdr),
.TrapM, .WriteDataM(LSUWriteDataM), .TrapM, .WriteDataM(LSUWriteDataM),
.ReadDataWordM(ReadDataWordM[`XLEN-1:0]), .ByteMaskM(ByteMaskM[`XLEN/8-1:0])); .ReadDataWordM(ReadDataWordM[`XLEN-1:0]), .ByteMaskM(ByteMaskM[`XLEN/8-1:0]));

View File

@ -74,7 +74,7 @@ module ram_ahb #(parameter BASE=0, RANGE = 65535) (
// single-ported RAM // single-ported RAM
bram1p1rw #(`XLEN/8, 8, ADDR_WIDTH, `FPGA) bram1p1rw #(`XLEN/8, 8, ADDR_WIDTH, `FPGA)
memory(.clk(HCLK), .we(memwriteD), .bwe(HWSTRB), .addr(RamAddr[ADDR_WIDTH+OFFSET-1:OFFSET]), .dout(HREADRam), .din(HWDATA)); memory(.clk(HCLK), .ce(1'b1), .we(memwriteD), .bwe(HWSTRB), .addr(RamAddr[ADDR_WIDTH+OFFSET-1:OFFSET]), .dout(HREADRam), .din(HWDATA));
// use this to add arbitrary latency to ram. Helps test AHB controller correctness // use this to add arbitrary latency to ram. Helps test AHB controller correctness
if(`RAM_LATENCY > 0) begin if(`RAM_LATENCY > 0) begin

View File

@ -49,6 +49,6 @@ module rom_ahb #(parameter BASE=0, RANGE = 65535) (
// single-ported ROM // single-ported ROM
brom1p1r #(ADDR_WIDTH, `XLEN, `FPGA) brom1p1r #(ADDR_WIDTH, `XLEN, `FPGA)
memory(.clk(HCLK), .addr(HADDR[ADDR_WIDTH+OFFSET-1:OFFSET]), .dout(HREADRom)); memory(.clk(HCLK), .ce(1'b1), .addr(HADDR[ADDR_WIDTH+OFFSET-1:OFFSET]), .dout(HREADRom));
endmodule endmodule