neat verilog thing

This commit is contained in:
Noah Boorstin 2021-04-18 17:48:51 -04:00
parent 0fa32ae5d6
commit 9bb1233433
2 changed files with 7 additions and 2 deletions

View File

@ -30,6 +30,10 @@
`include "wally-config.vh"
package ahbliteState;
typedef enum {IDLE, MEMREAD, MEMWRITE, INSTRREAD, INSTRREADC, ATOMICREAD, ATOMICWRITE, MMUTRANSLATE, MMUIDLE} statetype;
endpackage
module ahblite (
input logic clk, reset,
input logic StallW, FlushW,
@ -90,7 +94,7 @@ module ahblite (
// Data accesses have priority over instructions. However, if a data access comes
// while an instruction read is occuring, the instruction read finishes before
// the data access can take place.
typedef enum {IDLE, MEMREAD, MEMWRITE, INSTRREAD, INSTRREADC, ATOMICREAD, ATOMICWRITE, MMUTRANSLATE, MMUIDLE} statetype;
import ahbliteState::*;
statetype BusState, NextBusState;
flopenl #(.TYPE(statetype)) busreg(HCLK, ~HRESETn, 1'b1, NextBusState, IDLE, BusState);

View File

@ -191,9 +191,10 @@ module testbench_busybear();
logic [`XLEN-1:0] readAdrExpected;
import ahbliteState::*;
always @(dut.HRDATA) begin
#2;
if (dut.hart.MemRWM[1] && ~HWRITE && HADDR[31:3] != dut.PCF[31:3] && dut.HRDATA !== {64{1'bx}}) begin
if (dut.hart.MemRWM[1] && ~HWRITE && dut.hart.ebu.BusState == MEMREAD && dut.HRDATA !== {64{1'bx}}) begin
//$display("%0t", $time);
if($feof(data_file_memR)) begin
$display("no more memR data to read");