Skip to content

Commit

Permalink
[*] rtlgen generator was significantly updated, new structure, better…
Browse files Browse the repository at this point in the history
… types handling to provide vhdl compatibility that requires better bus width handling
  • Loading branch information
sergeykhbr committed Dec 9, 2023
1 parent 9c78886 commit e768492
Show file tree
Hide file tree
Showing 83 changed files with 397 additions and 397 deletions.
4 changes: 2 additions & 2 deletions sc/prj/common/vips/sdcard/vip_sdcard_cmdio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ void vip_sdcard_cmdio::comb() {
case CMDSTATE_REQ_STARTBIT:
v_busy = 0;
v_crc7_clear = 1;
if ((r.spi_mode && i_cs) == 1) {
if ((r.spi_mode.read() && i_cs.read()) == 1) {
// Do nothing
} else if ((r.cmdz.read() == 1) && (i_cmd.read() == 0)) {
v.cs = i_cs;
Expand Down Expand Up @@ -291,7 +291,7 @@ void vip_sdcard_cmdio::comb() {
v.cmd_state = CMDSTATE_RESP;
if (r.spi_mode.read() == 0) {
v.bitcnt = 39;
vb_cmd_txshift = 0ull;
vb_cmd_txshift = 0;
vb_cmd_txshift(45, 40) = r.cmd_rxshift.read()(45, 40);
vb_cmd_txshift(39, 8) = i_cmd_resp_data32;
vb_cmd_txshift(7, 0) = 0xFF;
Expand Down
2 changes: 1 addition & 1 deletion sc/prj/common/vips/sdcard/vip_sdcard_ctrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ SC_MODULE(vip_sdcard_ctrl) {
iv.ocr_vdd_window = 0;
iv.req_mem_valid = 0;
iv.req_mem_addr = 0;
iv.shiftdat = ~0ul;
iv.shiftdat = ~0ull;
iv.bitcnt = 0;
iv.crc16_clear = 0;
iv.crc16_next = 0;
Expand Down
4 changes: 2 additions & 2 deletions sc/prj/common/vips/sdcard/vip_sdcard_top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ void vip_sdcard_top::comb() {
w_dat2_dir = 1; // in: reserved
w_dat3_dir = 1; // in: cs

w_dat0_out = (((!w_dat_trans) & w_cmdio_cmd_out.read())
w_dat0_out = (((!w_dat_trans.read()) & w_cmdio_cmd_out.read())
| (w_dat_trans.read() & wb_dat.read()[3]));
w_dat1_out = 1;
w_dat2_out = 1;
Expand Down Expand Up @@ -308,7 +308,7 @@ void vip_sdcard_top::comb() {
w_stat_erase_param = 0;
w_stat_out_of_range = 0;
wb_mem_rdata = 0xFF;
wb_crc16 = 0x7fa1;
wb_crc16 = 0x7FA1;
}

} // namespace debugger
Expand Down
2 changes: 1 addition & 1 deletion sc/prj/common/vips/sdcard/vip_sdcard_top.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ SC_MODULE(vip_sdcard_top) {
static const uint8_t CFG_SDCARD_VHS = 0x1;
static const bool CFG_SDCARD_PCIE_1_2V = 0;
static const bool CFG_SDCARD_PCIE_AVAIL = 0;
static const uint32_t CFG_SDCARD_VDD_VOLTAGE_WINDOW = 0xff8000;
static const uint32_t CFG_SDCARD_VDD_VOLTAGE_WINDOW = 0xFF8000;

sc_signal<bool> w_clk;
sc_signal<sc_uint<8>> wb_rdata;
Expand Down
16 changes: 8 additions & 8 deletions sc/prj/common/vips/spi/vip_spi_top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ vip_spi_top::vip_spi_top(sc_module_name name,
instnum_ = instnum;
baudrate_ = baudrate;
scaler_ = scaler;
pll_period = (1.0 / ((2 * scaler) * baudrate));
pll_period = (1.0 / ((2 * scaler_) * baudrate_));
clk0 = 0;
tx0 = 0;

Expand Down Expand Up @@ -146,40 +146,40 @@ void vip_spi_top::comb() {
}

switch (wb_req_addr.read()(7, 2)) {
case 0x0: // [0x00] hwid
case 0x00: // [0x00] hwid
rdata = 0xCAFECAFE;
break;
case 0x1: // [0x04] scratch0
case 0x01: // [0x04] scratch0
rdata = r.scratch0;
if ((w_req_valid.read() == 1) && (w_req_write.read() == 1)) {
v.scratch0 = wb_req_wdata;
}
break;
case 0x2: // [0x08] scratch1
case 0x02: // [0x08] scratch1
rdata = r.scratch1;
if ((w_req_valid.read() == 1) && (w_req_write.read() == 1)) {
v.scratch1 = wb_req_wdata;
}
break;
case 0x3: // [0x0C] scratch2
case 0x03: // [0x0C] scratch2
rdata = r.scratch2;
if ((w_req_valid.read() == 1) && (w_req_write.read() == 1)) {
v.scratch2 = wb_req_wdata;
}
break;
case 0x4: // [0x10] uart control
case 0x04: // [0x10] uart control
rdata[0] = r.uart_loopback.read();
if ((w_req_valid.read() == 1) && (w_req_write.read() == 1)) {
v.uart_loopback = wb_req_wdata.read()[0];
}
break;
case 0x5: // [0x14] gpio in
case 0x05: // [0x14] gpio in
rdata(15, 0) = wb_gpio_in;
if ((w_req_valid.read() == 1) && (w_req_write.read() == 1)) {
v.gpio_out = wb_req_wdata.read()(15, 0);
}
break;
case 0x6: // [0x18] gpio direction
case 0x06: // [0x18] gpio direction
rdata(15, 0) = r.gpio_dir;
if ((w_req_valid.read() == 1) && (w_req_write.read() == 1)) {
v.gpio_dir = wb_req_wdata.read()(15, 0);
Expand Down
8 changes: 4 additions & 4 deletions sc/prj/common/vips/spi/vip_spi_transmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ vip_spi_transmitter::vip_spi_transmitter(sc_module_name name,

async_reset_ = async_reset;
scaler_ = scaler;
scaler_max = ((2 * scaler) - 1);
scaler_max = ((2 * scaler_) - 1);
scaler_mid = scaler;

SC_METHOD(comb);
Expand Down Expand Up @@ -115,8 +115,8 @@ void vip_spi_transmitter::comb() {
}

v.sclk = i_sclk;
v_pos = ((!r.sclk) && i_sclk);
v_neg = (r.sclk && (!i_sclk));
v_pos = ((!r.sclk.read()) && i_sclk.read());
v_neg = (r.sclk.read() && (!i_sclk.read()));

if ((i_csn.read() == 0) && (v_pos == 1)) {
v.rxshift = (r.rxshift.read()(31, 0), i_mosi.read());
Expand Down Expand Up @@ -156,7 +156,7 @@ void vip_spi_transmitter::comb() {
v.bytecnt = 0;
v.state = state_data;
v.req_addr = r.rxshift;
v.req_valid = (!r.req_write);
v.req_valid = (!r.req_write.read());
}
break;
case state_data:
Expand Down
4 changes: 2 additions & 2 deletions sc/prj/common/vips/spi/vip_spi_transmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ SC_MODULE(vip_spi_transmitter) {
void vip_spi_transmitter_r_reset(vip_spi_transmitter_registers &iv) {
iv.state = state_cmd;
iv.sclk = 0;
iv.rxshift = ~0ul;
iv.txshift = ~0ul;
iv.rxshift = ~0ull;
iv.txshift = ~0ull;
iv.bitcnt = 0;
iv.bytecnt = 0;
iv.byterdy = 0;
Expand Down
6 changes: 3 additions & 3 deletions sc/prj/common/vips/uart/vip_uart_receiver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ vip_uart_receiver::vip_uart_receiver(sc_module_name name,

async_reset_ = async_reset;
scaler_ = scaler;
scaler_max = ((2 * scaler) - 1);
scaler_max = ((2 * scaler_) - 1);
scaler_mid = scaler;

SC_METHOD(comb);
Expand Down Expand Up @@ -82,8 +82,8 @@ void vip_uart_receiver::comb() {
v = r;

v.rx = i_rx;
v_rx_pos = ((!r.rx) && i_rx);
v_rx_neg = (r.rx && (!i_rx));
v_rx_pos = ((!r.rx.read()) && i_rx.read());
v_rx_neg = (r.rx.read() && (!i_rx.read()));
if (i_rdy_clr.read() == 1) {
v.rdy = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions sc/prj/common/vips/uart/vip_uart_top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ vip_uart_top::vip_uart_top(sc_module_name name,
baudrate_ = baudrate;
scaler_ = scaler;
logpath_ = logpath;
pll_period = (1.0 / ((2 * scaler) * baudrate));
pll_period = (1.0 / ((2 * scaler_) * baudrate_));
clk0 = 0;
rx0 = 0;
tx0 = 0;
Expand Down Expand Up @@ -145,7 +145,7 @@ void vip_uart_top::comb() {
v = r;

w_tx_we = (w_rx_rdy.read() & i_loopback_ena.read());
w_rx_rdy_clr = (!w_tx_full);
w_rx_rdy_clr = (!w_tx_full.read());
v.initdone = ((r.initdone.read()[0] << 1) | 1);

if (!async_reset_ && i_nrst.read() == 0) {
Expand Down
2 changes: 1 addition & 1 deletion sc/prj/common/vips/uart/vip_uart_transmitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ vip_uart_transmitter::vip_uart_transmitter(sc_module_name name,

async_reset_ = async_reset;
scaler_ = scaler;
scaler_max = ((2 * scaler) - 1);
scaler_max = ((2 * scaler_) - 1);

SC_METHOD(comb);
sensitive << i_nrst;
Expand Down
2 changes: 1 addition & 1 deletion sc/prj/common/vips/uart/vip_uart_transmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ SC_MODULE(vip_uart_transmitter) {
iv.sample = 0;
iv.txdata_rdy = 0;
iv.txdata = 0;
iv.shiftreg = ~0ul;
iv.shiftreg = ~0ull;
iv.bitpos = 0;
iv.overflow = 0;
}
Expand Down
4 changes: 2 additions & 2 deletions sc/rtl/ambalib/axi_slv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void axi_slv::comb() {
}
break;
case State_data_r:
v.req_valid = ((!r.req_last_r) & i_xslvi.read().r_ready);
v.req_valid = ((!r.req_last_r.read()) & i_xslvi.read().r_ready);
if ((i_resp_valid.read() == 1) && (r.req_done.read() == 1)) {
v.req_done = 0;
v.resp_valid = 1;
Expand All @@ -272,7 +272,7 @@ void axi_slv::comb() {
v.req_len = vb_req_len_next;
v.req_last_a = (!vb_req_len_next.or_reduce());
v.req_last_r = r.req_last_a;
v.req_valid = ((!r.req_last_a) & i_xslvi.read().r_ready);
v.req_valid = ((!r.req_last_a.read()) & i_xslvi.read().r_ready);
v.req_done = 1;
}
break;
Expand Down
4 changes: 2 additions & 2 deletions sc/rtl/ambalib/axictrl_bus0.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ void axictrl_bus0::comb() {

v = r;

vb_def_mapinfo.addr_start = 0ull;
vb_def_mapinfo.addr_end = 0ull;
vb_def_mapinfo.addr_start = 0;
vb_def_mapinfo.addr_end = 0;
for (int i = 0; i < CFG_BUS0_XMST_TOTAL; i++) {
vmsto[i] = i_xmsto[i]; // Cannot read vector item from port in systemc
vmsti[i] = axi4_master_in_none;
Expand Down
24 changes: 12 additions & 12 deletions sc/rtl/ambalib/types_amba.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class mapinfo_type {
public:
mapinfo_type() {
// Base Address.
addr_start = 0ull;
addr_start = 0;
// Maskable bits of the base address.
addr_end = 0ull;
addr_end = 0;
}

mapinfo_type(uint64_t addr_start_,
Expand Down Expand Up @@ -80,7 +80,7 @@ class mapinfo_type {
};

// @brief Empty entry value for the map info table
static const mapinfo_type mapinfo_none;
static const mapinfo_type mapinfo_none = {0, 0};

// Burst length size decoder
static const int XSIZE_TOTAL = 8;
Expand Down Expand Up @@ -159,7 +159,7 @@ static const uint8_t AC_SNOOP_MAKE_INVALID = 0xD;
class axi4_metadata_type {
public:
axi4_metadata_type() {
addr = 0ull;
addr = 0;
// @brief Burst length.
// @details This signal indicates the exact number of transfers in
// a burst. This changes between AXI3 and AXI4. nastiXLenBits=8 so
Expand Down Expand Up @@ -328,7 +328,7 @@ class axi4_master_out_type {
public:
axi4_master_out_type() {
aw_valid = 0;
aw_bits.addr = 0ull;
aw_bits.addr = 0;
aw_bits.len = 0;
aw_bits.size = 0;
aw_bits.burst = AXI_BURST_INCR;
Expand All @@ -340,13 +340,13 @@ class axi4_master_out_type {
aw_id = 0;
aw_user = 0;
w_valid = 0;
w_data = 0ull;
w_data = 0;
w_last = 0;
w_strb = 0;
w_user = 0;
b_ready = 0;
ar_valid = 0;
ar_bits.addr = 0ull;
ar_bits.addr = 0;
ar_bits.len = 0;
ar_bits.size = 0;
ar_bits.burst = AXI_BURST_INCR;
Expand Down Expand Up @@ -541,7 +541,7 @@ class axi4_master_in_type {
ar_ready = 0;
r_valid = 0;
r_resp = 0;
r_data = 0ull;
r_data = 0;
r_last = 0;
r_id = 0;
r_user = 0;
Expand Down Expand Up @@ -643,7 +643,7 @@ class axi4_slave_in_type {
public:
axi4_slave_in_type() {
aw_valid = 0;
aw_bits.addr = 0ull;
aw_bits.addr = 0;
aw_bits.len = 0;
aw_bits.size = 0;
aw_bits.burst = AXI_BURST_INCR;
Expand All @@ -655,13 +655,13 @@ class axi4_slave_in_type {
aw_id = 0;
aw_user = 0;
w_valid = 0;
w_data = 0ull;
w_data = 0;
w_last = 0;
w_strb = 0;
w_user = 0;
b_ready = 0;
ar_valid = 0;
ar_bits.addr = 0ull;
ar_bits.addr = 0;
ar_bits.len = 0;
ar_bits.size = 0;
ar_bits.burst = AXI_BURST_INCR;
Expand Down Expand Up @@ -852,7 +852,7 @@ class axi4_slave_out_type {
ar_ready = 0;
r_valid = 0;
r_resp = 0;
r_data = 0ull;
r_data = 0;
r_last = 0;
r_id = 0;
r_user = 0;
Expand Down
14 changes: 7 additions & 7 deletions sc/rtl/ambalib/types_bus0.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ typedef sc_vector<sc_signal<mapinfo_type>> bus0_mapinfo_vector;

// Bus 0 device tree
static const mapinfo_type CFG_BUS0_MAP[CFG_BUS0_XSLV_TOTAL] = {
{0x0000000010000ull, 0x0000000050000ull}, // 0, bootrom, 256 KB
{0x0000002000000ull, 0x0000002010000ull}, // 1, clint
{0x0000008000000ull, 0x0000008200000ull}, // 2, sram, 2MB
{0x000000C000000ull, 0x0000010000000ull}, // 3, plic
{0x0000010000000ull, 0x0000010100000ull}, // 4, APB bridge: uart1
{0x0000080000000ull, 0x00000C0000000ull}, // 5, ddr, 512 MB
{0x0000800000000ull, 0x0001000000000ull} // 6, sdctrl, 32 GB
{0x0000000000010000, 0x0000000000050000}, // 0, bootrom, 256 KB
{0x0000000002000000, 0x0000000002010000}, // 1, clint
{0x0000000008000000, 0x0000000008200000}, // 2, sram, 2MB
{0x000000000C000000, 0x0000000010000000}, // 3, plic
{0x0000000010000000, 0x0000000010100000}, // 4, APB bridge: uart1
{0x0000000080000000, 0x00000000C0000000}, // 5, ddr, 512 MB
{0x0000000800000000, 0x0000001000000000} // 6, sdctrl, 32 GB
};

} // namespace debugger
Expand Down
14 changes: 7 additions & 7 deletions sc/rtl/ambalib/types_bus1.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ typedef sc_vector<sc_signal<mapinfo_type>> bus1_mapinfo_vector;

// Bus 1 device tree
static const mapinfo_type CFG_BUS1_MAP[CFG_BUS1_PSLV_TOTAL] = {
{0x0000000010000ull, 0x0000000011000ull}, // 0, uart1 4KB
{0x0000000012000ull, 0x0000000013000ull}, // 1, PRCI 4KB
{0x000000001E000ull, 0x000000001F000ull}, // 2, dmi 4KB. TODO: change base address
{0x0000000050000ull, 0x0000000051000ull}, // 4, SPI SD-card 4KB
{0x0000000060000ull, 0x0000000061000ull}, // 3, GPIO 4KB
{0x00000000C0000ull, 0x00000000C1000ull}, // 5, DDR MGMT 4KB
{0x00000000ff000ull, 0x0000000100000ull} // 6, Plug'n'Play 4KB
{0x0000000000010000, 0x0000000000011000}, // 0, uart1 4KB
{0x0000000000012000, 0x0000000000013000}, // 1, PRCI 4KB
{0x000000000001E000, 0x000000000001F000}, // 2, dmi 4KB. TODO: change base address
{0x0000000000050000, 0x0000000000051000}, // 4, SPI SD-card 4KB
{0x0000000000060000, 0x0000000000061000}, // 3, GPIO 4KB
{0x00000000000C0000, 0x00000000000C1000}, // 5, DDR MGMT 4KB
{0x00000000000FF000, 0x0000000000100000} // 6, Plug'n'Play 4KB
};

} // namespace debugger
Expand Down
Loading

0 comments on commit e768492

Please sign in to comment.