Skip to content

Commit

Permalink
Bender.yml.tpl: Improvements and src_future
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMightyDuckOfDoom committed Aug 25, 2023
1 parent 3aeb2bd commit 30b06b8
Show file tree
Hide file tree
Showing 9 changed files with 76 additions and 100 deletions.
8 changes: 8 additions & 0 deletions Bender.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,16 @@ packages:
dependencies:
- axi
- common_cells
- idma_future
- idma_pkg
- tb_idma_backend
idma_future:
revision: null
version: null
source:
Path: /home/bsc22h2/bachelor-thesis/iDMA/src/backend/../../src_future
dependencies:
- common_cells
idma_pkg:
revision: null
version: null
Expand Down
25 changes: 3 additions & 22 deletions src/backend/Bender.yml.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ dependencies:
common_cells: { git: "https://github.com/pulp-platform/common_cells.git", version: 1.31.1 }
axi: { git: "https://github.com/pulp-platform/axi.git", version: 0.39.0 }

tb_idma_backend: { path: "../../test" }
idma_pkg: { path: "../package" }
tb_idma_backend: { path: "../../test" }
idma_pkg: { path: "../package" }
idma_future: { path: "../../src_future" }

export_include_dirs:
- ../include
Expand All @@ -22,26 +23,6 @@ sources:
# levels 1 and 0, etc. Files within a level are ordered alphabetically.

# Level 0
# Protocol Managers
- src/protocol_managers/axi_lite/idma_axi_lite_read.sv
- src/protocol_managers/axi_lite/idma_axi_lite_write.sv
- src/protocol_managers/axi/idma_axi_read.sv
- src/protocol_managers/axi/idma_axi_write.sv
- src/protocol_managers/obi/idma_obi_read.sv
- src/protocol_managers/obi/idma_obi_write.sv
- src/protocol_managers/tilelink/idma_tilelink_read.sv
- src/protocol_managers/tilelink/idma_tilelink_write.sv
- src/protocol_managers/init/idma_init_read.sv
- src/protocol_managers/axi_stream/idma_axi_stream_read.sv
- src/protocol_managers/axi_stream/idma_axi_stream_write.sv

- src/idma_stream_fifo.sv
- src/idma_improved_fifo.sv
- src/idma_legalizer_page_splitter.sv
- src/idma_legalizer_pow2_splitter.sv
# Level 1
- src/idma_dataflow_element.sv
- src/idma_error_handler.sv
- src/idma_channel_coupler.sv

# Backends
54 changes: 0 additions & 54 deletions src/backend/src/idma_buffer.sv

This file was deleted.

21 changes: 21 additions & 0 deletions src_future/Bender.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Copyright 2022 ETH Zurich and University of Bologna.
# Solderpad Hardware License, Version 0.51, see LICENSE for details.
# SPDX-License-Identifier: SHL-0.51

# Modules that should at some point be moved to the common_cells repo
package:
name: idma_future
authors:
- "Tobias Senti <[email protected]>"

dependencies:
common_cells: { git: "https://github.com/pulp-platform/common_cells.git", version: 1.31.1 }

sources:
- include_dirs:
- ../include
files:
- idma_stream_fifo.sv
- idma_improved_fifo.sv
- idma_legalizer_page_splitter.sv
- idma_legalizer_pow2_splitter.sv
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//
// Tobias Senti <[email protected]>
module idma_legalizer_pow2_splitter #(
parameter int unsigned PageAddrWidth = 3,
parameter int unsigned OffsetWidth = 2,
parameter int unsigned PageAddrWidth = 3,
parameter type addr_t = logic,
parameter type len_t = logic
)(
Expand Down
File renamed without changes.
66 changes: 43 additions & 23 deletions util/idma_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def indent_block(block, indentation):
# Check if required fields are available
if 'prefix' not in file:
raise Exception(filename, ': "prefix" not found!')
prefix = file['prefix']

if 'protocol_enum' not in file:
raise Exception(filename, ': "protocol_enum" not found!')
Expand Down Expand Up @@ -73,40 +74,49 @@ def indent_block(block, indentation):
raise Exception(filename, 'Database must atleast include a\
"read_template" or a "write_template"')

if ('read_template' in file) and ('read_meta_channel' not in file):
raise Exception(filename, ': "read_meta_channel" not found!')
if ('read_template' in file):
if ('read_meta_channel' not in file):
raise Exception(filename, ': "read_meta_channel" not found!')

if ('read_template' in file) and ('meta_channel_width' not in file) and ('read_meta_channel_width' not in file):
raise Exception(filename, ': "read_meta_channel_width" not found!')
if ('meta_channel_width' not in file) and ('read_meta_channel_width' not in file):
raise Exception(filename, ': "read_meta_channel_width" not found!')

if ('read_template' in file) and ('synth_wrapper_ports_read' not in file):
raise Exception(filename, ': "synth_wrapper_ports_read" not found!')
if ('synth_wrapper_ports_read' not in file):
raise Exception(filename, ': "synth_wrapper_ports_read" not found!')

if ('read_template' in file) and ('synth_wrapper_assign_read' not in file):
raise Exception(filename, ': "synth_wrapper_assign_read" not found!')
if ('synth_wrapper_assign_read' not in file):
raise Exception(filename, ': "synth_wrapper_assign_read" not found!')

if ('read_template' in file) and ('legalizer_read_meta_channel' not in file):
raise Exception(filename, ': "legalizer_read_meta_channel" not found!')
if ('legalizer_read_meta_channel' not in file):
raise Exception(filename, ': "legalizer_read_meta_channel" not found!')

if ('write_template' in file) and ('write_meta_channel' not in file):
raise Exception(filename, ': "write_meta_channel" not found!')
read_manager_path = 'src/backend/src/protocol_managers/' + prefix + '/idma_' + prefix + '_read.sv'
if not os.path.isfile(read_manager_path):
raise Exception(filename, ': Read manager file "' + read_manager_path + '" cannot be found!')

if ('write_template' in file) and ('meta_channel_width' not in file) and ('write_meta_channel_width' not in file):
raise Exception(filename, ': "write_meta_channel_width" not found!')
if ('write_template' in file):
if ('write_meta_channel' not in file):
raise Exception(filename, ': "write_meta_channel" not found!')

if ('write_template' in file) and ('synth_wrapper_ports_write' not in file):
raise Exception(filename, ': "synth_wrapper_ports_write" not found!')
if ('meta_channel_width' not in file) and ('write_meta_channel_width' not in file):
raise Exception(filename, ': "write_meta_channel_width" not found!')

if ('write_template' in file) and ('synth_wrapper_assign_write' not in file):
raise Exception(filename, ': "synth_wrapper_assign_write" not found!')
if ('synth_wrapper_ports_write' not in file):
raise Exception(filename, ': "synth_wrapper_ports_write" not found!')

if ('write_template' in file) and ('legalizer_write_meta_channel' not in file):
raise Exception(filename, ': "legalizer_write_meta_channel" not found!')
if ('synth_wrapper_assign_write' not in file):
raise Exception(filename, ': "synth_wrapper_assign_write" not found!')

if ('write_template' in file) and ('legalizer_write_data_path' not in file):
raise Exception(filename, ': "legalizer_write_data_path" not found!')
if ('legalizer_write_meta_channel' not in file):
raise Exception(filename, ': "legalizer_write_meta_channel" not found!')

if ('legalizer_write_data_path' not in file):
raise Exception(filename, ': "legalizer_write_data_path" not found!')

write_manager_path = 'src/backend/src/protocol_managers/' + prefix + '/idma_' + prefix + '_write.sv'
if not os.path.isfile(write_manager_path):
raise Exception(filename, ': Write manager file "' + write_manager_path + '" cannot be found!')

prefix = file['prefix']

if (prefix != 'axi') and ('write_template' in file) and ('bridge_template' not in file) and ('write_bridge_template' not in file):
raise Exception(filename, ': "write_bridge_template" or "bridge_template" not found!')
Expand Down Expand Up @@ -431,6 +441,16 @@ def generate_bender():
# If not -> Write template into it
with open('src/backend/Bender.yml.tpl', 'r', encoding='utf-8') as template_file:
content = template_file.read()

content += '\n # Protocol Managers\n'
for protocol in available_protocols:
content += '\n # ' + database[protocol]['full_name'] + '\n'
if protocol in available_read_protocols:
content += ' - src/protocol_managers/' + protocol + '/idma_' + protocol + '_read.sv\n'
if protocol in available_write_protocols:
content += ' - src/protocol_managers/' + protocol + '/idma_' + protocol + '_write.sv\n'

content += '\n # Backends\n'
else:
# Read contents of bender file
with open('src/backend/Bender.yml', 'r', encoding='utf-8') as bender_file:
Expand Down

0 comments on commit 30b06b8

Please sign in to comment.