mirror of
https://github.com/supleed2/ELEC50010-IAC-CW.git
synced 2024-12-22 13:25:49 +00:00
Stall bus memory when reset is high
This commit is contained in:
parent
e89087c127
commit
74681e8890
|
@ -1,5 +1,6 @@
|
|||
module mips_cpu_bus_memory( //Avalon memory mapped bus controller (slave)
|
||||
input logic clk,
|
||||
input logic reset,
|
||||
input logic[31:0] address,
|
||||
input logic write,
|
||||
input logic read,
|
||||
|
@ -43,10 +44,20 @@ initial begin
|
|||
for (integer i = 0; i<$size(data_memory); i++) begin //Read out data contents to log
|
||||
$display("byte +%h: %h", 32'h00001000+i*4, data_memory[i]);
|
||||
end
|
||||
|
||||
waitrequest = 1'b0; // set waitrequest low to begin
|
||||
readdata = 32'h00000000; // set readdata low to begin
|
||||
|
||||
end
|
||||
|
||||
always_comb begin
|
||||
if (reset) begin
|
||||
waitrequest = 1'b0;
|
||||
end
|
||||
end
|
||||
|
||||
always_ff @(posedge read or posedge write) begin
|
||||
waitrequest <= 1;
|
||||
waitrequest <= 1'b1;
|
||||
end
|
||||
|
||||
always_ff @(posedge clk) begin
|
||||
|
@ -86,5 +97,4 @@ always_ff @(posedge clk) begin
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
endmodule
|
|
@ -10,6 +10,7 @@ logic[3:0] byteenable;
|
|||
|
||||
mips_cpu_bus_memory #(INSTR_INIT_FILE, DATA_INIT_FILE) memInst( //Avalon memory mapped bus controller (slave)
|
||||
.clk(clk), // clk input to mem
|
||||
.reset(reset), // reset input to stall mem during cpu reset
|
||||
.address(address), // addr input to mem
|
||||
.write(write), // write flag input
|
||||
.read(read), // read flag input
|
||||
|
|
Loading…
Reference in a new issue