Skip to content

Commit

Permalink
tracer: Update tracer to the multiprotocol version of iDMA (#8)
Browse files Browse the repository at this point in the history
* Add a tracer for the DMA #8
  • Loading branch information
thommythomaso committed Oct 27, 2023
1 parent fb0d514 commit c98e6f1
Show file tree
Hide file tree
Showing 17 changed files with 240 additions and 104 deletions.
1 change: 1 addition & 0 deletions Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ dependencies:

export_include_dirs:
- src/include
- target/rtl/include

sources:
# Source files grouped in levels. Files in level 0 have no dependencies on files in this
Expand Down
6 changes: 6 additions & 0 deletions idma.mk
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,18 @@ $(IDMA_RTL_DIR)/tb_idma_backend_%.sv: $(IDMA_GEN) $(IDMA_RTL_DIR)/idma_backend_%
$(IDMA_VSIM_DIR)/wave/backend_%.do: $(IDMA_GEN) $(IDMA_RTL_DIR)/tb_idma_backend_%.sv $(IDMA_VSIM_DIR)/wave/tpl/backend.do.tpl
$(call idma_gen,vsim_wave,$(IDMA_VSIM_DIR)/wave/tpl/backend.do.tpl,$(IDMA_DB_FILES),$*,,$@)

$(IDMA_RTL_DIR)/include/idma/tracer.svh: $(IDMA_GEN) $(IDMA_GEN_SRC) $(IDMA_ROOT)/src/include/idma/tpl/tracer.svh.tpl $(IDMA_DB_FILES) $(IDMA_ROOT)/idma.mk
mkdir -p $(IDMA_RTL_DIR)/include/idma
$(call idma_gen,tracer,$(IDMA_ROOT)/src/include/idma/tpl/tracer.svh.tpl,$(IDMA_DB_FILES),$(IDMA_BACKEND_IDS),$(IDMA_FE_IDS),$@)

idma_rtl_clean:
rm -f $(IDMA_RTL_DIR)/Bender.yml
rm -f $(IDMA_RTL_DIR)/*.sv
rm -f $(IDMA_VSIM_DIR)/wave/*.do
rm -f $(IDMA_RTL_DIR)/include/idma/tracer.svh

# assemble the required files
IDMA_RTL_ALL += $(IDMA_RTL_DIR)/include/idma/tracer.svh
IDMA_RTL_ALL += $(foreach X,$(IDMA_RTL_FILES),$(foreach Y,$(IDMA_BACKEND_IDS),$X_$Y.sv))
IDMA_TB_ALL += $(foreach Y,$(IDMA_BACKEND_IDS),$(IDMA_RTL_DIR)/tb_idma_backend_$Y.sv)
IDMA_TB_ALL += $(foreach Y,$(IDMA_BACKEND_IDS),$(IDMA_VSIM_DIR)/wave/backend_$Y.do)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ sphinx-rtd-theme
recommonmark
sphinxcontrib-svg2pdfconverter
pylint
flatdict
10 changes: 10 additions & 0 deletions src/db/idma_axi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,13 @@ synth_wrapper_assign_read: |
assign axi_read_rsp.r.last = axi_r_last_i;
assign axi_read_rsp.r.user = axi_r_user_i;
assign axi_read_rsp.r_valid = axi_r_valid_i;
trace_signals:
read:
rsp:
valid: axi_read_rsp.r_valid
ready: axi_read_req.r_ready
write:
req:
valid: axi_write_req.w_valid
ready: axi_write_rsp.w_ready
strobe: axi_write_req.w.strb
10 changes: 10 additions & 0 deletions src/db/idma_axi_lite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,13 @@ synth_wrapper_assign_read: |
assign axi_lite_read_rsp.r.data = axi_lite_r_data_i;
assign axi_lite_read_rsp.r.resp = axi_lite_r_resp_i;
assign axi_lite_read_rsp.r_valid = axi_lite_r_valid_i;
trace_signals:
read:
rsp:
valid: axi_lite_read_rsp.r_valid
ready: axi_lite_read_req.r_ready
write:
req:
valid: axi_lite_write_req.w_valid
ready: axi_lite_write_rsp.w_ready
strobe: axi_lite_write_req.w.strb
11 changes: 11 additions & 0 deletions src/db/idma_axi_stream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,14 @@ synth_wrapper_assign_write: |
assign axi_stream_write_tvalid_o = axi_stream_write_req.tvalid;
assign axi_stream_write_rsp.tready = axi_stream_write_tready_i;
trace_signals:
read:
rsp:
valid: axi_stream_read_rsp.tvalid
ready: axi_stream_read_req.tready
strobe: axi_stream_read_rsp.t.strb
write:
req:
valid: axi_stream_write_req.tvalid
ready: axi_stream_write_rsp.tready
strobe: axi_stream_write_req.t.strb
9 changes: 9 additions & 0 deletions src/db/idma_init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,12 @@ synth_wrapper_assign_read: |
assign init_read_rsp.rsp_valid = init_read_rsp_valid_i;
assign init_read_rsp.rsp_chan.init_value = init_read_rsp_init_value_i;
assign init_read_rsp_ready_o = init_read_req.rsp_ready;
trace_signals:
read:
req:
valid: init_read_req.req_valid
config: init_read_req.req_chan.cfg
ready: init_read_rsp.req_ready
rsp:
valid: init_read_rsp.rsp_valid
ready: init_read_req.rsp_ready
11 changes: 11 additions & 0 deletions src/db/idma_obi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,14 @@ synth_wrapper_assign_read: |
assign obi_read_rsp.r_valid = obi_read_rsp_r_valid_i;
assign obi_read_rsp.r.rdata = obi_read_rsp_r_rdata_i;
assign obi_read_rsp.r.rid = obi_read_rsp_r_rid_i;
trace_signals:
read:
rsp:
valid: obi_write_rsp_r_valid_i
ready: obi_write_rsp_r_valid_i
write:
req:
valid: obi_write_req.a_req
ready: assign obi_write_rsp.a_gnt
strobe: obi_write_req.a.be
write_en: obi_write_req.a.we
10 changes: 10 additions & 0 deletions src/db/idma_tilelink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,3 +241,13 @@ synth_wrapper_assign_read: |
assign tilelink_read_rsp.d.denied = tilelink_read_rsp_d_denied_i;
assign tilelink_read_rsp.d.data = tilelink_read_rsp_d_data_i;
assign tilelink_read_rsp.d.corrupt = tilelink_read_rsp_d_corrupt_i;
trace_signals:
read:
rsp:
valid: tilelink_read_rsp.d_valid
ready: tilelink_read_req.d_ready
write:
req:
valid: tilelink_write_req.a_valid
ready: tilelink_write_rsp.a_ready
strobe: tilelink_write_req.a.mask
30 changes: 30 additions & 0 deletions src/include/idma/tpl/tracer.svh.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2023 ETH Zurich and University of Bologna.
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
// SPDX-License-Identifier: SHL-0.51
//
// Authors:
// - Thomas Benz <tbenz@ethz.ch>

// Macro holding all the resources for the iDMA backend tracer
`ifndef IDMA_TRACER_SVH_
`define IDMA_TRACER_SVH_

// largest type to trace
`define IDMA_TRACER_MAX_TYPE_WIDTH 1024
`define IDMA_TRACER_MAX_TYPE logic [`IDMA_TRACER_MAX_TYPE_WIDTH-1:0]

// string assembly function
`define IDMA_TRACER_STR_ASSEMBLY(__dict, __cond) <%text>\\</%text>
if(__cond) begin <%text>\\</%text>
trace = $sformatf("%s'%s':{", trace, `"__dict`"); <%text>\\</%text>
foreach(__dict``[key]) trace = $sformatf("%s'%s': 0x%0x,", trace, key, __dict``[key]); <%text>\\</%text>
trace = $sformatf("%s},", trace); <%text>\\</%text>
end

// helper to clear a condition
`define IDMA_TRACER_CLEAR_COND(__cond) <%text>\\</%text>
if(__cond) begin <%text>\\</%text>
__cond = ~__cond; <%text>\\</%text>
end
${body}
`endif
101 changes: 0 additions & 101 deletions src/include/idma/tracer.svh

This file was deleted.

1 change: 1 addition & 0 deletions target/rtl/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Bender.yml
include
*.sv
*.hjson
1 change: 1 addition & 0 deletions target/rtl/tpl/Bender.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ dependencies:
export_include_dirs:
- ../../src/include
- ../../test
- include

sources:
# Source files grouped in levels. Files in level 0 have no dependencies on files in this
Expand Down
5 changes: 4 additions & 1 deletion util/gen_idma.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
from mario.synth import render_synth_wrapper
from mario.testbench import render_testbench
from mario.frontend import render_reg_hjson, render_reg_top
from mario.tracer import render_tracer

GENABLE_ENTITIES = ['transport', 'legalizer', 'backend', 'vsim_wave', 'testbench', 'synth_wrapper',
'bender', 'reg_top', 'reg_hjson']
'bender', 'reg_top', 'reg_hjson', 'tracer']

EPILOG = '''
The iDMA configuration ID is composed of a underscore-separated list of specifiers and protocols.
Expand Down Expand Up @@ -73,6 +74,8 @@ def main():
print(render_reg_hjson(frontend_ids, args.tpl))
elif args.entity == 'reg_top':
print(render_reg_top(frontend_ids, args.tpl))
elif args.entity == 'tracer':
print(render_tracer(protocol_ids, protocol_db, args.tpl))
else:
return 1

Expand Down
2 changes: 1 addition & 1 deletion util/mario/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def render_synth_wrapper(prot_ids: dict, db: dict, tpl_file: str) -> str:
db[rp]['synth_wrapper_assign_read'] =\
' ' + db[rp]['synth_wrapper_assign_read'].replace('\n', '\n ')

for wp in used_read_prots:
for wp in used_write_prots:
db[wp]['synth_wrapper_ports_write'] =\
' ' + db[wp]['synth_wrapper_ports_write'].replace('\n', '\n ')
db[wp]['synth_wrapper_assign_write'] =\
Expand Down
Loading

0 comments on commit c98e6f1

Please sign in to comment.