Skip to content

Commit

Permalink
Added comments for documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ganeshgore committed Jul 28, 2022
1 parent 324e777 commit ae5fa8b
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions spydrnet_physical/composers/svg/composer.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,34 @@


class SVGComposer:
"""
Class create SVG composer based on yosys and netlist SVG.
"""

def __init__(self):
# nothing to do during initialization
pass

def run(self, netlist, file_out="out.svg"):
""" Main method to run composer """
verilog_file = "_"+file_out.replace(".svg", ".v")
# TODO
# Add option to suppress stdout printing of the yosys compilation
# Finish documentation and add in sphinx index
def run(self, netlist, yosys_cmmds="", svgout_file="out.svg"):
"""
Main method to run composer
args:
netlist
yosys_cmmds
svgout_file
"""
verilog_file = "_"+svgout_file.replace(".svg", ".v")
sdn.compose(netlist, verilog_file, skip_constraints=True)
top = netlist.top_instance.reference.name

json_file = "_"+file_out.replace(".svg", ".json")
json_file = "_"+svgout_file.replace(".svg", ".json")
os.system(f"yosys -p 'prep -top {top}; " +
yosys_cmmds +
f" write_json {json_file};' " +
f"{verilog_file}")
os.system(f"netlistsvg {json_file} -o {file_out};")
os.system(f"netlistsvg {json_file} -o {svgout_file};")

0 comments on commit ae5fa8b

Please sign in to comment.