From 9bb1233433edb50c8eb205cdfccf2e844cc39a8d Mon Sep 17 00:00:00 2001 From: Noah Boorstin Date: Sun, 18 Apr 2021 17:48:51 -0400 Subject: [PATCH] neat verilog thing --- wally-pipelined/src/ebu/ahblite.sv | 6 +++++- wally-pipelined/testbench/testbench-busybear.sv | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/wally-pipelined/src/ebu/ahblite.sv b/wally-pipelined/src/ebu/ahblite.sv index 0cfab6a5..25d1a226 100644 --- a/wally-pipelined/src/ebu/ahblite.sv +++ b/wally-pipelined/src/ebu/ahblite.sv @@ -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); diff --git a/wally-pipelined/testbench/testbench-busybear.sv b/wally-pipelined/testbench/testbench-busybear.sv index 11b2d3fa..fdcbf200 100644 --- a/wally-pipelined/testbench/testbench-busybear.sv +++ b/wally-pipelined/testbench/testbench-busybear.sv @@ -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");