-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20ef96d
commit e13749b
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
# Paul Scheffler <[email protected]> | ||
|
||
BENDER ?= bender | ||
MORTY ?= morty | ||
|
||
VLOG_ARGS ?= -suppress 2583 -suppress 13314 | ||
VSIM ?= vsim | ||
|
@@ -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) # | ||
################################# | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sources.json | ||
*.sv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')) |