Skip to content

Commit

Permalink
template files and paths
Browse files Browse the repository at this point in the history
  • Loading branch information
mattvenn committed Mar 16, 2023
1 parent 9e6891f commit b5745cc
Show file tree
Hide file tree
Showing 9 changed files with 8,581 additions and 24 deletions.
8 changes: 5 additions & 3 deletions caravel.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import logging
import json
import os


class CaravelConfig():

def __init__(self, projects, num_projects):
self.projects = projects
self.num_projects = num_projects
self.script_dir = os.path.dirname(os.path.realpath(__file__))

# create macro file & positions, power hooks
def create_macro_config(self):
Expand Down Expand Up @@ -87,7 +89,7 @@ def create_macro_config(self):

logging.info(f"total user macros placed: {num_macros_placed}")

with open("upw_config.json") as fh:
with open(os.path.join(self.script_dir, 'caravel_template', 'upw_config.json')) as fh:
caravel_config = json.load(fh)

power_domains = "vccd1 vssd1 vccd1 vssd1"
Expand Down Expand Up @@ -215,12 +217,12 @@ def instantiate(self):
# Write to file
with open('verilog/rtl/user_project_wrapper.v', 'w') as fh:
# Insert the Caravel preamble
with open("upw_pre.v", "r") as fh_pre:
with open(os.path.join(self.script_dir, 'caravel_template', 'upw_pre.v')) as fh_pre:
fh.write(fh_pre.read())
# Indent, join, and insert the module instances
fh.write("\n".join([(" " + x).rstrip() for x in body]))
# Insert the Caravel postamble
with open("upw_post.v", "r") as fh_post:
with open(os.path.join(self.script_dir, 'caravel_template', 'upw_post.v')) as fh_post:
fh.write(fh_post.read())

# build the blackbox_project_includes.v file - used for blackboxing when building the GDS
Expand Down
Loading

0 comments on commit b5745cc

Please sign in to comment.