-
Notifications
You must be signed in to change notification settings - Fork 0
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
e143884
commit 211677b
Showing
23 changed files
with
948 additions
and
10 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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: ldo | ||
|
||
on: | ||
# push: | ||
# branches: | ||
# - main | ||
# pull_request: | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
generate: | ||
runs-on: self-hosted | ||
steps: | ||
|
||
- name: Clone this repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Clone OpenFASOC repo | ||
run: | | ||
mkdir $GITHUB_WORKSPACE/openfasoc && cd $GITHUB_WORKSPACE/openfasoc | ||
git clone https://github.com/idea-fasoc/OpenFASOC && cd OpenFASOC | ||
- name: Run the generator and build gds, verilog, reports and spice decks | ||
run: | | ||
cd $GITHUB_WORKSPACE/regression && python3 run_regression.py ldo generate | ||
simulate: | ||
runs-on: self-hosted | ||
steps: | ||
|
||
- name: Clone this repo | ||
uses: actions/checkout@v2 | ||
|
||
|
||
- name: Run simulations by sweeping input parameters defined inside the config file under configuration directory | ||
run: | | ||
cd $GITHUB_WORKSPACE/regression | ||
docker run --rm -v $HOME:$HOME -e USER=$USER -w $PWD openfasoc_ci_image:latest bash -c "pip install pyyaml && python3 run_regression.py ldo simulate" | ||
process: | ||
runs-on: self-hosted | ||
steps: | ||
|
||
- name: Clone this repo | ||
uses: actions/checkout@v2 | ||
|
||
|
||
- name: Process the results using the simulation log files and extract results | ||
run: | | ||
cd $GITHUB_WORKSPACE/regression && python3 run_regression.py ldo process |
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,52 @@ | ||
name: tempsense | ||
|
||
on: | ||
# push: | ||
# branches: | ||
# - main | ||
# pull_request: | ||
workflow_dispatch: | ||
|
||
|
||
jobs: | ||
generate: | ||
runs-on: self-hosted | ||
steps: | ||
|
||
- name: Clone this repo | ||
uses: actions/checkout@v2 | ||
|
||
- name: Clone OpenFASOC repo | ||
run: | | ||
mkdir $GITHUB_WORKSPACE/openfasoc && cd $GITHUB_WORKSPACE/openfasoc | ||
git clone https://github.com/idea-fasoc/OpenFASOC && cd OpenFASOC | ||
- name: Run the generator and build gds, verilog, reports and spice decks | ||
run: | | ||
cd $GITHUB_WORKSPACE/regression && python3 run_regression.py tempsense generate | ||
simulate: | ||
runs-on: self-hosted | ||
steps: | ||
|
||
- name: Clone this repo | ||
uses: actions/checkout@v2 | ||
|
||
|
||
- name: Run simulations by sweeping input parameters defined inside the config file under configuration directory | ||
run: | | ||
cd $GITHUB_WORKSPACE/regression | ||
docker run --rm -v $HOME:$HOME -e USER=$USER -w $PWD openfasoc_ci_image:latest bash -c "pip install pyyaml && python3 run_regression.py tempsense simulate" | ||
process: | ||
runs-on: self-hosted | ||
steps: | ||
|
||
- name: Clone this repo | ||
uses: actions/checkout@v2 | ||
|
||
|
||
- name: Process the results using the simulation log files and extract results | ||
run: | | ||
cd $GITHUB_WORKSPACE/regression && python3 run_regression.py tempsense process |
File renamed without changes.
File renamed without changes.
Empty file.
Empty file.
Empty 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,16 @@ | ||
# generator_name | ||
ldo-gen: | ||
|
||
# technology | ||
- sky130hvl | ||
|
||
# inputs: | ||
# - header: start, stop, step | ||
# - inverter: start, stop, step | ||
|
||
# inputs: | ||
# - VoltsOut: start, stop, step | ||
# - AmpsMax: start, stop, step | ||
- inputs: | ||
- VoltsOut: 1.8, 3.3, 0.5 | ||
- AmpsMax: 0.5, 25, 0.5 |
File renamed without changes.
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,3 @@ | ||
designName: ldoInst | ||
vin: [1.8, 1.9, 0.1] | ||
imax: [1, 1.5, 0.5] |
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,3 @@ | ||
designName: tempSenseInst_error | ||
ninv: [2, 10, 2] | ||
nhead: [5, 9, 1] |
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,6 @@ | ||
# https://stackoverflow.com/a/1057534 | ||
|
||
from os.path import dirname, basename, isfile, join | ||
import glob | ||
modules = glob.glob(join(dirname(__file__), "*.py")) | ||
__all__ = [ basename(f)[:-3] for f in modules if isfile(f) and not f.endswith('__init__.py')] |
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,164 @@ | ||
# idea is to use this file to run checks for the particular generator. Basically it should include prePEX simulations, postPEX simulations, | ||
# DRC/LVS checks. | ||
|
||
# each check will be a python module. Before the check, another module should be present to run the generator. The concept behind having these | ||
# modules is to import them into the main run_regression script. There is also another config file which has the input parameters range. It can also contain additional info but for now nothing other than the range is read. | ||
|
||
import os, sys, fileinput, datetime, math | ||
import subprocess as sp | ||
|
||
|
||
class regression_ldo(): | ||
|
||
''' | ||
Regression class will have the following methods - | ||
1. run_generator() -> to run the generator with the given arguments (not the input range directly) and generate all files | ||
2. checkDRC() -> to check and display the count of DRC errors - extracted from the report generated in the end | ||
3. checkLVS() -> to check and display the LVS errors if any - extracted from the report generated in the end | ||
4. copyData() -> to copy data from the generated location to the temporary result location. | ||
5. runSimulations() -> to run the simulations and generate logfiles | ||
6. processSims() -> to process the simulations log data and generate final data | ||
''' | ||
|
||
def __init__(self) -> None: | ||
self.image = "openfasoc_ci_image:latest" | ||
self.home_dir = "/home/"+os.getenv("USER")+"/OpenFASOC/" | ||
self.results_work_dir = self.home_dir+"openfasoc/generators/ldo-gen/work" | ||
self.runner_results_dir = "/home/"+os.getenv("USER")+"/runner_results" | ||
|
||
|
||
def run_generator(self, imax, vin): | ||
''' | ||
Run the generator using subprocess for the given configuration vins and imaxs. | ||
Returns the path where the work folder is present along with simulations/run folder which contains the spice netlists | ||
''' | ||
|
||
cmd = "pip3 install -r requirements.txt && cd openfasoc/generators/ldo-gen/ && make clean && make sky130hvl_ldo_full VoltsOut={0} AmpsMax={1}e-03 | tee -a {0}_vin_{1}mA_imax.log".format(vin, imax) | ||
|
||
os.chdir(self.home_dir) | ||
|
||
status = os.system("docker run --rm -v {0}:{0} -w {0} {1} bash -c '{2}'".format(os.getcwd(),self.image, cmd)) | ||
|
||
return status | ||
|
||
|
||
def checkDRC(self): | ||
''' | ||
Reads 6_final_drc.rpt inside work directory of the generator and returns 1, if errors are found. Else 0. | ||
''' | ||
drc_rpt = self.results_work_dir+"/6_final_drc.rpt" | ||
with open(drc_rpt) as report: | ||
drc_errors = len(report.readlines()) - 3 | ||
|
||
if drc_errors: | ||
return 1 | ||
else: | ||
return 0 | ||
|
||
|
||
def checkLVS(self): | ||
''' | ||
Read 6_final_lvs.rpt inside work directory of the generator and grep for the word 'Failed'. If found, return 1. Else return 0. | ||
''' | ||
lvs_rpt = self.results_work_dir+"/6_final_lvs.rpt" | ||
with open(lvs_rpt) as report: | ||
|
||
if "failed" in report.read(): | ||
return 1 | ||
else: | ||
return 0 | ||
|
||
|
||
def copyData(self, imax, vin): | ||
''' | ||
Copy work directory and simulation/run directory to temporary run location where simulations and processing of data are done. | ||
''' | ||
os.system("mkdir -p "+self.runner_results_dir+"/ldo/{0}_vin_{1}mA_imax".format(vin, imax)) | ||
os.system("cp -rf "+ self.results_work_dir + "/../simulations/run/* "+ self.runner_results_dir+"/ldo/{0}_vin_{1}mA_imax".format(vin, imax)) | ||
os.system("cp -rf "+ self.results_work_dir + " " + self.runner_results_dir+"/ldo/{0}_vin_{1}mA_imax".format(vin, imax)) | ||
os.system("mv "+self.results_work_dir+"/../{0}_vin_{1}mA_imax.log ".format(vin, imax) + self.runner_results_dir+"/ldo/{0}_vin_{1}mA_imax".format(vin, imax)) | ||
os.system("sudo rm -rf "+self.results_work_dir + "/../simulations/run") | ||
|
||
|
||
def runSimulations(self, vin, imax): | ||
''' | ||
Run through all above copied directories, go into each prePEX folder and replace tempInstance_error.spice netlist path. | ||
Then run simulations using subprocess python library. Returns the list of subprocess which | ||
we loop through and run wait command. | ||
ref: https://github.com/idea-fasoc/OpenFASOC-sims/blob/main/utils/run_sim.py | ||
''' | ||
|
||
|
||
# get the list of all folders inside /home/runner_results/ | ||
|
||
designName = "ldo" | ||
freqs_list = [0.1,1.0,10.0] | ||
caps_list = [1,5] | ||
processes=[] | ||
|
||
rootDir = self.runner_results_dir+"/ldo/{0}_vin_{1}mA_imax".format(vin, imax) | ||
i = rootDir | ||
|
||
if os.path.isdir(i): | ||
|
||
config=i.split("/")[-1].split("_") | ||
vin=config[0] | ||
imax=config[2] | ||
|
||
# "['ngspice -b -o ldo_0.1MHz_1p_out.txt -i ldo_tran_1.0mA_0.1MHz_1p.sp', 'ngspice -b -o ldo_0.1MHz_5p_out.txt -i ldo_tran_1.0mA_0.1MHz_5p.sp', 'ngspice -b -o ldo_1.0MHz_1p_out.txt -i ldo_tran_1.0mA_1.0MHz_1p.sp', 'ngspice -b -o ldo_1.0MHz_5p_out.txt -i ldo_tran_1.0mA_1.0MHz_5p.sp', 'ngspice -b -o ldo_10.0MHz_1p_out.txt -i ldo_tran_1.0mA_10.0MHz_1p.sp', 'ngspice -b -o ldo_10.0MHz_5p_out.txt -i ldo_tran_1.0mA_10.0MHz_5p.sp', 'ngspice -b -o pwrout.txt -i pwrarr.sp', 'ngspice -b -o ldo_load_change.txt -i ldo_load_change.sp']" | ||
|
||
|
||
# look for directory name starting with PEX and prePEX and build path to ammend to the filename. | ||
for j in ["prePEX"]: | ||
path = i+"/{0}_PT_cells_13".format(j) | ||
runDir = path | ||
|
||
for freq in freqs_list: | ||
for cap in caps_list: | ||
|
||
p = sp.Popen( | ||
[ | ||
"ngspice", | ||
"-b", | ||
"-o", | ||
"{0}/{1}_{2}MHz_{3}p_out.txt".format(path, designName, freq, cap), | ||
"-i", | ||
"{0}/{1}_tran_{2}_{3}MHz_{4}p.sp".format(path, designName, imax, freq, cap), | ||
], | ||
cwd=runDir, | ||
) | ||
processes.append(p) | ||
|
||
# last two testbenches | ||
p = sp.Popen( | ||
[ | ||
"ngspice", | ||
"-b", | ||
"-o", | ||
"pwrout.txt", | ||
"-i", | ||
"pwrarr.sp", | ||
] | ||
) | ||
processes.append(p) | ||
|
||
p = sp.Popen( | ||
[ | ||
"ngspice", | ||
"-b", | ||
"-o", | ||
"ldo_load_change.txt", | ||
"-i", | ||
"ldo_load_change.sp", | ||
] | ||
) | ||
processes.append(p) | ||
|
||
return processes | ||
|
||
|
||
def processSims(self, vin, imax): | ||
|
||
pass | ||
|
Oops, something went wrong.