Skip to content

Commit

Permalink
Various smaller fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thommythomaso committed Apr 4, 2024
1 parent 93330e4 commit f812abf
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 26 deletions.
14 changes: 7 additions & 7 deletions hw/occamy/occamy_soc.sv.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ module ${name}_soc
<% in_sys_idma_mst = soc_wide_xbar.__dict__["in_sys_idma_mst"] %>\

// local regbus definition
`REG_BUS_TYPEDEF_ALL(idma_cfg_reg_a${wide_in.aw}_d31, logic [${wide_in.aw-1}:0], logic [31:0], logic [7:0])
`REG_BUS_TYPEDEF_ALL(idma_cfg_reg_a${wide_in.aw}_d32, logic [${wide_in.aw-1}:0], logic [31:0], logic [3:0])

// iDMA types
localparam int unsigned iDMAStrbWidth = ${wide_in.dw} / 32'd8;
Expand All @@ -433,15 +433,15 @@ module ${name}_soc

// AXI meta channels
typedef struct packed {
${out_sys_idma_cfg.ar_chan_type()} ar_chan;
${wide_out.ar_chan_type()} ar_chan;
} axi_read_meta_channel_t;

typedef struct packed {
axi_read_meta_channel_t axi;
} read_meta_channel_t;

typedef struct packed {
${out_sys_idma_cfg.aw_chan_type()} aw_chan;
${wide_out.aw_chan_type()} aw_chan;
} axi_write_meta_channel_t;

typedef struct packed {
Expand Down Expand Up @@ -530,10 +530,10 @@ module ${name}_soc
);

idma_backend_rw_axi #(
.DataWidth ( ${wide_in.dw-1} ),
.AddrWidth ( ${wide_in.aw-1} ),
.UserWidth ( ${wide_in.uw} ),
.AxiIdWidth ( ${wide_in.iw-1} ),
.DataWidth ( ${wide_out.dw} ),
.AddrWidth ( ${wide_out.aw} ),
.UserWidth ( ${wide_out.uw+1} ),
.AxiIdWidth ( ${wide_out.iw} ),
.NumAxInFlight ( 32'd64 ),
.BufferDepth ( 32'd3 ),
.TFLenWidth ( ${wide_in.aw-1} ),
Expand Down
6 changes: 4 additions & 2 deletions target/sim/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ VSIM_FLAGS += -do "log -r /*; run -a"
# TODO: Workaround; revise
VSIM_FLAGS += -warning 8386

VOPT_FLAGS += +acc

VCS_FLAGS += +nospecify
VCS_FLAGS += -Mdir=work-vcs
VCS_FLAGS += -Mlib=work-vcs
Expand Down Expand Up @@ -402,7 +404,7 @@ clean-addrmap:
rm -rf $(TARGET_ADDRMAP_DIR)

$(TARGET_ADDRMAP_DIR):
mkdir $@
mkdir -p $@

ADDRMAP_OCCAMYGEN_TARGETS = $(ADDRMAP_DOT) $(ADDRMAP_CSV)
$(ADDRMAP_OCCAMYGEN_TARGETS): .addrmap_occamygen_targets_group
Expand Down Expand Up @@ -613,4 +615,4 @@ help:
@echo -e ""
@echo -e "Additional useful targets from the included Makefrag:"
@echo -e "${Blue}traces ${Black}Generate the better readable traces in .logs/trace_hart_<hart_id>.txt with spike-dasm."
@echo -e "${Blue}annotate ${Black}Annotate the better readable traces in .logs/trace_hart_<hart_id>.s with the source code related with the retired instructions."
@echo -e "${Blue}annotate ${Black}Annotate the better readable traces in .logs/trace_hart_<hart_id>.s with the source code related with the retired instructions."
50 changes: 33 additions & 17 deletions target/sim/sw/shared/platform/generated/sys_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,48 @@
#ifdef __cplusplus
extern "C" {
#endif

// Number of dimensions available
#define IDMA_REG64_1D_PARAM_NUM_DIMS 1

// Register width
#define IDMA_REG64_FRONTEND_PARAM_REG_WIDTH 64
#define IDMA_REG64_1D_PARAM_REG_WIDTH 32

// Source Address
#define IDMA_REG64_FRONTEND_SRC_ADDR_REG_OFFSET 0x0
#define IDMA_REG64_FRONTEND_SRC_ADDR_REG_OFFSET 0xd8

// Destination Address
#define IDMA_REG64_FRONTEND_DST_ADDR_REG_OFFSET 0x8
#define IDMA_REG64_FRONTEND_DST_ADDR_REG_OFFSET 0xd0

// Number of bytes
#define IDMA_REG64_FRONTEND_NUM_BYTES_REG_OFFSET 0x10
#define IDMA_REG64_FRONTEND_NUM_BYTES_REG_OFFSET 0xe0

// Configuration Register for DMA settings
#define IDMA_REG64_FRONTEND_CONF_REG_OFFSET 0x18
#define IDMA_REG64_FRONTEND_CONF_DECOUPLE_BIT 0
#define IDMA_REG64_FRONTEND_CONF_DEBURST_BIT 1
#define IDMA_REG64_FRONTEND_CONF_SERIALIZE_BIT 2
#define IDMA_REG64_FRONTEND_CONF_REG_OFFSET 0
#define IDMA_REG64_FRONTEND_CONF_REG_DECOUPLE_AW_BIT 0
#define IDMA_REG64_FRONTEND_CONF_REG_DECOUPLE_RW_BIT 1
#define IDMA_REG64_FRONTEND_CONF_REG_SRC_REDUCE_LEN_BIT 2
#define IDMA_REG64_FRONTEND_CONF_REG_DST_REDUCE_LEN_BIT 3
#define IDMA_REG64_FRONTEND_CONF_REG_SRC_MAX_LLEN_MASK 0x7
#define IDMA_REG64_FRONTEND_CONF_REG_SRC_MAX_LLEN_OFFSET 4
#define IDMA_REG64_FRONTEND_CONF_REG_SRC_MAX_LLEN_FIELD \
((bitfield_field32_t) { .mask = IDMA_REG64_FRONTEND_CONF_REG_SRC_MAX_LLEN_MASK, .index = IDMA_REG64_FRONTEND_CONF_REG_SRC_MAX_LLEN_OFFSET })
#define IDMA_REG64_FRONTEND_CONF_REG_DST_MAX_LLEN_MASK 0x7
#define IDMA_REG64_FRONTEND_CONF_REG_DST_MAX_LLEN_OFFSET 7
#define IDMA_REG64_FRONTEND_CONF_REG_DST_MAX_LLEN_FIELD \
((bitfield_field32_t) { .mask = IDMA_REG64_FRONTEND_CONF_REG_DST_MAX_LLEN_MASK, .index = IDMA_REG64_FRONTEND_CONF_REG_DST_MAX_LLEN_OFFSET })
#define IDMA_REG64_FRONTEND_CONF_REG_ENABLE_ND_BIT 10


// DMA Status
#define IDMA_REG64_FRONTEND_STATUS_REG_OFFSET 0x20
#define IDMA_REG64_FRONTEND_STATUS_REG_OFFSET 0x4
#define IDMA_REG64_FRONTEND_STATUS_BUSY_BIT 0

// Next ID, launches transfer, returns 0 if transfer not set up properly.
#define IDMA_REG64_FRONTEND_NEXT_ID_REG_OFFSET 0x28
#define IDMA_REG64_FRONTEND_NEXT_ID_REG_OFFSET 0x44

// Get ID of finished transactions.
#define IDMA_REG64_FRONTEND_DONE_REG_OFFSET 0x30
#define IDMA_REG64_FRONTEND_DONE_REG_OFFSET 0x84

#ifdef __cplusplus
} // extern "C"
Expand All @@ -63,9 +78,9 @@ extern "C" {
#define IDMA_DONE_ADDR \
(SYS_IDMA_CFG_BASE_ADDR + IDMA_REG64_FRONTEND_DONE_REG_OFFSET)

#define IDMA_CONF_DECOUPLE 0
#define IDMA_CONF_DEBURST 0
#define IDMA_CONF_SERIALIZE 0
#define IDMA_CONF_DECOUPLE_AW 0
#define IDMA_CONF_DECOUPLE_RW 0
#define IDMA_CONF_REDUCE_LLEN 0

inline volatile uint64_t *sys_dma_src_ptr(void) {
return (volatile uint64_t *)IDMA_SRC_ADDR;
Expand Down Expand Up @@ -94,9 +109,10 @@ inline uint64_t sys_dma_memcpy(uint64_t dst, uint64_t src, uint64_t size) {
*(sys_dma_dst_ptr()) = (uint64_t)dst;
*(sys_dma_num_bytes_ptr()) = size;
*(sys_dma_conf_ptr()) =
(IDMA_CONF_DECOUPLE << IDMA_REG64_FRONTEND_CONF_DECOUPLE_BIT) |
(IDMA_CONF_DEBURST << IDMA_REG64_FRONTEND_CONF_DEBURST_BIT) |
(IDMA_CONF_SERIALIZE << IDMA_REG64_FRONTEND_CONF_SERIALIZE_BIT);
(IDMA_CONF_DECOUPLE_AW << IDMA_REG64_FRONTEND_CONF_REG_DECOUPLE_AW_BIT) |
(IDMA_CONF_DECOUPLE_RW << IDMA_REG64_FRONTEND_CONF_REG_DECOUPLE_RW_BIT) |
(IDMA_CONF_REDUCE_LLEN << IDMA_REG64_FRONTEND_CONF_REG_SRC_REDUCE_LEN_BIT) |
(IDMA_CONF_REDUCE_LLEN << IDMA_REG64_FRONTEND_CONF_REG_DST_REDUCE_LEN_BIT);
return *(sys_dma_nextid_ptr());
}

Expand Down

0 comments on commit f812abf

Please sign in to comment.