Skip to content

Commit

Permalink
Add pickle target
Browse files Browse the repository at this point in the history
  • Loading branch information
thommythomaso committed Sep 26, 2023
1 parent 20ef96d commit e13749b
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cheshire.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# Paul Scheffler <[email protected]>

BENDER ?= bender
MORTY ?= morty

VLOG_ARGS ?= -suppress 2583 -suppress 13314
VSIM ?= vsim
Expand Down Expand Up @@ -163,6 +164,17 @@ $(CHS_ROOT)/target/xilinx/scripts/add_sources.tcl: Bender.yml

CHS_XILINX_ALL += $(CHS_ROOT)/target/xilinx/scripts/add_sources.tcl

#############
# Pickle #
#############

$(CHS_ROOT)/target/pickle/sources.json: Bender.yml Bender.lock
$(BENDER) sources -t fpga -t cv64a6_imafdcsclic_sv39 -t cva6 -f > $@

$(CHS_ROOT)/target/pickle/%.sv: $(CHS_ROOT)/target/pickle/sources.json
$(MORTY) -f $^ --top $* -i --sequential --propagate_defines -o $@


#################################
# Phonies (KEEP AT END OF FILE) #
#################################
Expand Down
2 changes: 2 additions & 0 deletions target/pickle/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sources.json
*.sv
34 changes: 34 additions & 0 deletions target/pickle/get_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import sys
import time
from pyslang import *

class ModuleVisitor:
def __init__(self, file_in: str):
self.tree = SyntaxTree.fromText(file_in)
self.comp = Compilation()
self.comp.addSyntaxTree(self.tree)
# Analysis results; contains per-transform dicts indexed by *syntax source start offsets*!
# self.compinfo = defaultdict(dict)
# self.compinfo['__eval'] = EvalContext(self.comp)
# self.compinfo['__iterate'] = self._iterate_member

def traverse(self) -> str:
# Analyze compilation first and collect info
self.comp.getRoot().visit(self._comp_visit)
#return self._rewrite_member(self.tree.root)

def _comp_visit(self, sym):
print(sym)
#if isinstance(sym, AssignmentExpression):
# analyze_assignment(self.compinfo, sym)
#elif isinstance(sym, Expression):
# analyze_expression(self.compinfo, sym)

def main(file_in: str, top_module: str):
ModuleVisitor(file_in).traverse()



# TODO: cmdline parser!
if __name__ == '__main__':
sys.exit(main('cheshire_soc.sv', 'cheshire_soc'))

0 comments on commit e13749b

Please sign in to comment.