#ifndef AXI_SIGNAL_PORTS
#define AXI_SIGNAL_PORTS
#include <systemc.h>
#include <stdio.h>
//#define VERBOSE
#define SLAVE_WRITE_DELAY 10
#define SLAVE_READ_DELAY 10
#define SCRN_WIDTH 320
#define SCRN_HEIGHT 200
class AXI_SIGNALS {
public:
// AR channel signals
sc_signal <sc_uint<2>> ARID; // need to change bit width to ID_WIDTH
sc_signal <sc_uint<32>> ARADDR;
sc_signal <sc_uint<4>> ARLEN; // need to change width to LEN_WIDTH
sc_signal <sc_uint<3>> ARSIZE;
sc_signal <sc_uint<2>> ARBURST;
sc_signal <bool> ARVALID;
sc_signal <bool> ARREADY;
// R channel signals
sc_signal <sc_uint<2>> RID; // need to change bit width to ID_WIDTH
sc_signal <sc_uint<32>> RDATA;
sc_signal <bool> RLAST;
sc_signal <bool> RVALID;
sc_signal <bool> RREADY;
// AW Channel signals
sc_signal <sc_uint<2>> AWID; // need to change bit width to ID_WIDTH
sc_signal <sc_uint<32>> AWADDR;
sc_signal <sc_uint<4>> AWLEN; // need to change width to LEN_WIDTH
sc_signal <sc_uint<3>> AWSIZE;
sc_signal <sc_uint<2>> AWBURST;
sc_signal <bool> AWVALID;
sc_signal <bool> AWREADY;
// W Channel singals
sc_signal <sc_uint<2>> WID; // need to change bit width to ID_WIDTH
sc_signal <sc_uint<32>> WDATA;
sc_signal <bool> WLAST;
sc_signal <bool> WVALID;
sc_signal <bool> WREADY;
// B Channel singals
sc_signal <sc_uint<2>> BID; // need to change bit width to ID_WIDTH
sc_signal <bool> BVALID;
sc_signal <bool> BREADY;
AXI_SIGNALS() {};
};
class SLAVE_PORTS {
private:
public:
// AR channel signals
sc_in <sc_uint<2>> ARID; // need to change bit width to ID_WIDTH
sc_in <sc_uint<32>> ARADDR;
sc_in <sc_uint<4>> ARLEN;
sc_in <sc_uint<3>> ARSIZE;
sc_in <sc_uint<2>> ARBURST;
sc_in <bool> ARVALID;
sc_out <bool> ARREADY;
// R channel signals
sc_out <sc_uint<2>> RID;
sc_out <sc_uint<32>> RDATA;
sc_out <bool> RLAST;
sc_out <bool> RVALID;
sc_in <bool> RREADY;
// AW Channel signals
sc_in <sc_uint<2>> AWID;
sc_in <sc_uint<32>> AWADDR;
sc_in <sc_uint<4>> AWLEN;
sc_in <sc_uint<3>> AWSIZE;
sc_in <sc_uint<2>> AWBURST;
sc_in <bool> AWVALID;
sc_out <bool> AWREADY;
// W Channel singals
sc_in <sc_uint<2>> WID;
sc_in <sc_uint<32>> WDATA;
sc_in <bool> WLAST;
sc_in <bool> WVALID;
sc_out <bool> WREADY;
// B Channel singals
sc_out <sc_uint<2>> BID;
sc_out <bool> BVALID;
sc_in <bool> BREADY;
SLAVE_PORTS() {};
};
class MASTER_PORTS {
private:
public:
// AR channel signals
sc_out <sc_uint<2>> ARID;
sc_out <sc_uint<32>> ARADDR;
sc_out <sc_uint<4>> ARLEN;
sc_out <sc_uint<3>> ARSIZE;
sc_out <sc_uint<2>> ARBURST;
sc_out <bool> ARVALID;
sc_in <bool> ARREADY;
// R channel signals
sc_in <sc_uint<2>> RID;
sc_in <sc_uint<32>> RDATA;
sc_in <bool> RLAST;
sc_in <bool> RVALID;
sc_out <bool> RREADY;
// AW Channel signals
sc_out <sc_uint<2>> AWID;
sc_out <sc_uint<32>> AWADDR;
sc_out <sc_uint<4>> AWLEN;
sc_out <sc_uint<3>> AWSIZE;
sc_out <sc_uint<2>> AWBURST;
sc_out <bool> AWVALID;
sc_in <bool> AWREADY;
// W Channel singals
sc_out <sc_uint<2>> WID;
sc_out <sc_uint<32>> WDATA;
sc_out <bool> WLAST;
sc_out <bool> WVALID;
sc_in <bool> WREADY;
// B Channel singals
sc_in <sc_uint<2>> BID;
sc_in <bool> BVALID;
sc_out <bool> BREADY;
MASTER_PORTS(){ };
};
class AXITransaction {
public:
sc_uint <4> ID;
sc_uint<32> addr;
sc_uint <3> size;
sc_uint <2> type;
sc_uint <4> len;
bool bus_allow;
bool ar_released = false;
bool r_released = false;
bool aw_released = false;
bool w_released = false;
bool b_released = false;
};
class memory_map {
public:
sc_uint<32> base_addr;
sc_uint<32> addr_size;
sc_uint<4> slave_id;
};
void bind_port_signal(MASTER_PORTS* a, AXI_SIGNALS& b) {
a->ARID(b.ARID);
a->ARADDR(b.ARADDR);
a->ARLEN(b.ARLEN);
a->ARSIZE(b.ARSIZE);
a->ARBURST(b.ARBURST);
a->ARVALID(b.ARVALID);
a->ARREADY(b.ARREADY);
a->RID(b.RID);
a->RDATA(b.RDATA);
a->RLAST(b.RLAST);
a->RVALID(b.RVALID);
a->RREADY(b.RREADY);
a->AWID(b.AWID);
a->AWADDR(b.AWADDR);
a->AWLEN(b.AWLEN);
a->AWSIZE(b.AWSIZE);
a->AWBURST(b.AWBURST);
a->AWVALID(b.AWVALID);
a->AWREADY(b.AWREADY);
a->WID(b.WID);
a->WDATA(b.WDATA);
a->WLAST(b.WLAST);
a->WVALID(b.WVALID);
a->WREADY(b.WREADY);
a->BID(b.BID);
a->BVALID(b.BVALID);
a->BREADY(b.BREADY);
}
void bind_port_signal(SLAVE_PORTS* a, AXI_SIGNALS& b) {
a->ARID(b.ARID);
a->ARADDR(b.ARADDR);
a->ARLEN(b.ARLEN);
a->ARSIZE(b.ARSIZE);
a->ARBURST(b.ARBURST);
a->ARVALID(b.ARVALID);
a->ARREADY(b.ARREADY);
a->RID(b.RID);
a->RDATA(b.RDATA);
a->RLAST(b.RLAST);
a->RVALID(b.RVALID);
a->RREADY(b.RREADY);
a->AWID(b.AWID);
a->AWADDR(b.AWADDR);
a->AWLEN(b.AWLEN);
a->AWSIZE(b.AWSIZE);
a->AWBURST(b.AWBURST);
a->AWVALID(b.AWVALID);
a->AWREADY(b.AWREADY);
a->WID(b.WID);
a->WDATA(b.WDATA);
a->WLAST(b.WLAST);
a->WVALID(b.WVALID);
a->WREADY(b.WREADY);
a->BID(b.BID);
a->BVALID(b.BVALID);
a->BREADY(b.BREADY);
}
#endif