vram: make arbiter clients and servers connectable

This commit is contained in:
David Anderson 2024-09-07 19:40:02 -07:00
parent aa048537ef
commit 81e5264d22
2 changed files with 15 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package MemArbiter; package MemArbiter;
import Connectable::*;
import Vector::*; import Vector::*;
export MemArbiterWrite(..); export MemArbiterWrite(..);
@ -22,6 +23,18 @@ interface MemArbiterClient#(type request);
method Action grant(); method Action grant();
endinterface endinterface
instance Connectable#(MemArbiterClient#(req), MemArbiterServer#(req));
module mkConnection(MemArbiterClient#(req) client, MemArbiterServer#(req) server, Empty ifc);
rule send_request;
server.request(client.request());
endrule
rule send_grant (server.grant());
client.grant();
endrule
endmodule
endinstance
typedef struct { typedef struct {
Bool write; Bool write;
addr addr; addr addr;

View File

@ -71,8 +71,6 @@ function TestCase testCase(String name,
endfunction endfunction
module mkTB(); module mkTB();
MemArbiter#(Addr) dut <- mkMemArbiter();
Vector#(29, TestCase) tests = vec( Vector#(29, TestCase) tests = vec(
testCase("All idle", testCase("All idle",
idle, idle, idle, idle, idle, idle,
@ -197,6 +195,8 @@ module mkTB();
read(0), idle, idle, read(0), idle, idle,
-1, 0)); -1, 0));
MemArbiter#(Addr) dut <- mkMemArbiter();
Reg#(UInt#(32)) idx <- mkReg(0); Reg#(UInt#(32)) idx <- mkReg(0);
rule display_test (idx == 0); rule display_test (idx == 0);