-
Notifications
You must be signed in to change notification settings - Fork 5
/
designcfg.py
32 lines (25 loc) · 1.02 KB
/
designcfg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import time
import os
import subprocess
class Design(object):
def __init__(self):
self.top_name = "design" + time.strftime("%Y-%m-%d", time.localtime())
self.is_Chisel_design = False
self.rtl_input = " "
self.Chisel_input = " "
self.result_dir = "./design/"
self.lib_name = "gscl45nm"
self.lef_input = " "
self.liberty_input = " "
self.clk_name = "clk"
self.delay = 100
def Chisel2RTL(self, verbose):
"""
Compile Chisel design to single verilog file
"""
print("========== Compiling Chisel to Verilog... ==========")
chisel_dir = self.Chisel_input
output = "" if verbose else f" > {os.path.join(self.result_dir, self.top_name, self.lib_name, 'reports/', 'sbt.log')}"
cmd = f'sbt "runMain {self.top_name}"' + output
subprocess.run(cmd, cwd=chisel_dir, shell=True)
self.rtl_input = os.path.join(self.Chisel_input, 'generated', '%s.v'%self.top_name)