@@ -6,7 +6,7 @@ import GetPut::*;
66typedef 32 AxiAddrWidth;
77typedef 32 AxiDataWidth;
88typedef 4 AxiIdWidth;
9- typedef 4 AxiUserWidth;
9+ typedef 0 AxiUserWidth;
1010
1111interface AxiIfc;
1212 interface AXI4_Slave_Rd_Fab# ( AxiAddrWidth, AxiDataWidth, AxiIdWidth, AxiUserWidth) rd;
@@ -21,9 +21,36 @@ interface OuterIfc;
2121 method Action writeBResp( AXI4_Write_Rs# ( AxiIdWidth, AxiUserWidth) resp) ;
2222 method Bool arValid;
2323 method Bool awValid;
24+ method Bool wValid;
2425 interface AxiIfc axi;
2526endinterface
2627
28+ typedef struct {
29+ Bit # ( AxiIdWidth) id;
30+ Bool last;
31+ } RStatus deriving ( Bits , Eq , FShow ) ;
32+
33+ typedef struct {
34+ Bit # ( 16 ) data;
35+ RStatus rStatus;
36+ } RSplit deriving ( Bits , Eq , FShow ) ;
37+
38+ typedef AXI4_Read_Rs# ( AxiDataWidth, AxiIdWidth, AxiUserWidth) RResp;
39+
40+ instance DefaultValue # ( RStatus) ;
41+ defaultValue = RStatus {
42+ id : 0 ,
43+ last : False
44+ } ;
45+ endinstance
46+
47+ instance DefaultValue # ( RSplit) ;
48+ defaultValue = RSplit {
49+ data : ? ,
50+ rStatus : defaultValue
51+ } ;
52+ endinstance
53+
2754typedef union tagged {
2855 AXI4_Read_Rq# ( AxiAddrWidth, AxiIdWidth, AxiUserWidth) READ_ADDR_REQ;
2956 AXI4_Write_Rq_Addr# ( AxiAddrWidth, AxiIdWidth, AxiUserWidth) WRITE_ADDR_REQ;
@@ -33,17 +60,32 @@ typedef union tagged {
3360
3461(* synthesize *)
3562module mkOuterPhy( OuterIfc) ;
36- AXI4_Slave_Rd# ( AxiAddrWidth, AxiDataWidth, AxiIdWidth, AxiUserWidth) s_rd < - mkAXI4_Slave_Rd_Dummy;
37- AXI4_Slave_Wr# ( AxiAddrWidth, AxiDataWidth, AxiIdWidth, AxiUserWidth) s_wr < - mkAXI4_Slave_Wr_Dummy;
63+ /*
64+ We implemented Pipeline FIFOs in the AR and AW channels ourselves,
65+ so there's no need to buffer the input.
66+ */
67+ AXI4_Slave_Rd# ( AxiAddrWidth, AxiDataWidth, AxiIdWidth, AxiUserWidth) s_rd < - mkAXI4_Slave_Rd( 0 , 1 ) ;
68+ AXI4_Slave_Wr# ( AxiAddrWidth, AxiDataWidth, AxiIdWidth, AxiUserWidth) s_wr < - mkAXI4_Slave_Wr( 0 , 1 , 1 ) ;
3869
3970 FIFOF # ( AXI4_Read_Rq# ( AxiAddrWidth, AxiIdWidth, AxiUserWidth)) arReqFifo < - mkFIFOF;
4071 FIFOF # ( AXI4_Write_Rq_Addr# ( AxiAddrWidth, AxiIdWidth, AxiUserWidth)) awReqFifo < - mkFIFOF;
72+ FIFOF # ( AXI4_Write_Rq_Data# ( AxiDataWidth, AxiUserWidth)) wReqFifo < - mkFIFOF;
4173
42- rule arReqFifoRule ;
74+ rule arReqFifoEnq ;
4375 let d < - s_rd.request.get;
4476 arReqFifo.enq( d) ;
4577 endrule
4678
79+ rule awReqFifoEnq;
80+ let d < - s_wr.request_addr.get;
81+ awReqFifo.enq( d) ;
82+ endrule
83+
84+ rule wReqFifoEnq;
85+ let d < - s_wr.request_data.get;
86+ wReqFifo.enq( d) ;
87+ endrule
88+
4789 method ActionValue # ( AXI4_Read_Rq# ( AxiAddrWidth, AxiIdWidth, AxiUserWidth)) readArReq;
4890 arReqFifo.deq;
4991 return arReqFifo.first;
@@ -55,8 +97,8 @@ module mkOuterPhy(OuterIfc);
5597 endmethod
5698
5799 method ActionValue # ( AXI4_Write_Rq_Data# ( AxiAddrWidth, AxiUserWidth)) readWReq;
58- let d < - s_wr.request_data.get ;
59- return d ;
100+ wReqFifo.deq ;
101+ return wReqFifo.first ;
60102 endmethod
61103
62104 method Action writeRResp( AXI4_Read_Rs# ( AxiDataWidth, AxiIdWidth, AxiUserWidth) resp) ;
@@ -75,6 +117,10 @@ module mkOuterPhy(OuterIfc);
75117 return awReqFifo.notEmpty;
76118 endmethod
77119
120+ method Bool wValid;
121+ return wReqFifo.notEmpty;
122+ endmethod
123+
78124 interface AxiIfc axi;
79125 interface AXI4_Slave_Rd_Fab rd = s_rd.fab;
80126 interface AXI4_Slave_Wr_Fab wr = s_wr.fab;
0 commit comments