Skip to content

Commit

Permalink
Adding missing models testing files
Browse files Browse the repository at this point in the history
  • Loading branch information
mohanad0mohamed authored and mithro committed Aug 20, 2022
1 parent 859d03b commit 5818a3c
Show file tree
Hide file tree
Showing 580 changed files with 11,002 additions and 0 deletions.
2 changes: 2 additions & 0 deletions models/ngspice/testing/.spiceinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
************
set ngbehavior=hs
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
182 changes: 182 additions & 0 deletions models/ngspice/testing/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
# Copyright 2022 Efabless Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#=================================================================
# ------------------------ models_ngspice ------------------------
#=================================================================

SHELL := /bin/bash
Testing_DIR ?= $(shell pwd)
run_folder := $(shell date +'run_%Y_%m_%d_%H:%M:%S')


.DEFAULT_GOAL := all

all : test-models_ngspice

test-models_ngspice: smoke-test models-MOS models-BJT models-diode models-MOSCAP models-MIMCAP models-RES

#================================
#---------- Create Run ----------
#================================

.ONESHELL:
Add_run-dir:
@cd $(Testing_DIR)
@ [ ! -d "$(run_folder)/" ] && cp -rf $(Testing_DIR)/regression $(Testing_DIR)/$(run_folder)

#================================
#---------- smoke-test ----------
#================================

.ONESHELL:
smoke-test:
@cd $(Testing_DIR)/smoke_test
@python3 ng_smoke_test.py


#================================
# ---------- models-MOS----------
#================================

.ONESHELL:
models-MOS: Add_run-dir
@cd $(Testing_DIR)/$(run_folder)/mos_iv_vgs
@echo "========== Runing models_ngspice-MOS regression ==========" |& tee -a ../run_log.log
@python3 models_regression.py |& tee -a ../run_log.log
# @cd ../mos_iv_vbs
# @python3 models_regression.py |& tee -a ../run_log.log

# .ONESHELL:
# clean-models-MOS:
# @echo "==== Cleaning models-MOS old runs ===="
# @cd $(Testing_DIR)/$(run_folder)/mos_iv_vgs && rm -rf nmos_* pmos_*

#================================
# ---------- models-BJT----------
#================================

.ONESHELL:
models-BJT: Add_run-dir
@cd $(Testing_DIR)/$(run_folder)/bjt_cj
@echo "========== Runing models_ngspice-BJT regression ==========" |& tee -a ../run_log.log
@python3 models_regression.py |& tee -a ../run_log.log


# .ONESHELL:
# clean-models-BJT:
# @echo "==== Cleaning models-BJT old runs ===="
# @cd $(Testing_DIR)/$(run_folder)/bjt_cj && rm -rf vnpn_* vpnp_*

#================================
# --------- models-diode --------
#================================

.ONESHELL:
models-diode: Add_run-dir
@cd $(Testing_DIR)/$(run_folder)/diode
@echo "========== Runing models_ngspice-didoe regression ==========" |& tee -a ../run_log.log
@python3 models_regression.py |& tee -a ../run_log.log


# .ONESHELL:
# clean-models-diode:
# @echo "==== Cleaning models-diode old runs ===="
# @cd $(Testing_DIR)/$(run_folder)/diode && rm -rf np_* pn_* nwp* dnw* sc_*

#================================
# -------- models-MOSCAP --------
#================================

.ONESHELL:
models-MOSCAP: Add_run-dir
@cd $(Testing_DIR)/$(run_folder)/moscap_c
@echo "========== Runing models_ngspice-MOSCAP regression ==========" |& tee -a ../run_log.log
@python3 models_regression.py |& tee -a ../run_log.log


# .ONESHELL:
# clean-models-MOSCAP:
# @echo "==== Cleaning models-MOSCAP old runs ===="
# @cd $(Testing_DIR)/$(run_folder)/moscap_c && rm -rf nmoscap_* pmoscap_*

#================================
# -------- models-MIMCAP --------
#================================

.ONESHELL:
models-MIMCAP: Add_run-dir
@cd $(Testing_DIR)/$(run_folder)/mimcap_c
@echo "========== Runing models_ngspice-MIMCAP regression ==========" |& tee -a ../run_log.log
@python3 models_regression.py |& tee -a ../run_log.log


# .ONESHELL:
# clean-models-MIMCAP:
# @echo "==== Cleaning models-MIMCAP old runs ===="
# @cd $(Testing_DIR)/$(run_folder)/mimcap_c && rm -rf mim*


#================================
# --------- models-RES ----------
#================================

.ONESHELL:
models-RES: Add_run-dir
@cd $(Testing_DIR)/$(run_folder)/resistor_r
@echo "========== Runing models_ngspice-RES regression ==========" |& tee -a ../run_log.log
@python3 models_regression.py |& tee -a ../run_log.log


# .ONESHELL:
# clean-models-RES:
# @echo "==== Cleaning models-RES old runs ===="
# @cd $(Testing_DIR)/$(run_folder)/resistor_r && rm -rf nplus* pplus* npoly* ppoly* rm* tm* nwell



# #===============================
# # --------- Clean ALL ----------
# #===============================

# .ONESHELL:
# clean: clean-models-MOS clean-models-BJT clean-models-diode clean-models-MOSCAP clean-models-MIMCAP clean-models-RES
# @echo "==== Cleaning all runs is done ===="


#==========================
# --------- HELP ----------
#==========================

# Help Target
help:
@echo "\n ==== The following are some of the valid targets for this Makefile ====\n"
@echo "... all (the default if no target is provided)"
@echo "... smoke-test (To run smoke test for an inverter)"
@echo "... test-models_ngspice (To run regression for all devices)"
@echo "... models-MOS (To run regression for MOS devices)"
@echo "... models-BJT (To run regression for BJT devices)"
@echo "... models-diode (To run regression for diode devices)"
@echo "... models-MOSCAP (To run regression for MOSCAP devices)"
@echo "... models-MIMCAP (To run regression for MIMCAP devices)"
@echo "... models-RES (To run regression for RES devices)"
# @echo "... clean-models-MOS (To clean old runs for MOS devices)"
# @echo "... clean-models-BJT (To clean old runs for BJT devices)"
# @echo "... clean-models-diode (To clean old runs for diode devices)"
# @echo "... clean-models-MOSCAP (To clean old runs for MOSCAP devices)"
# @echo "... clean-models-MIMCAP (To clean old runs for MIMCAP devices)"
# @echo "... clean-models-RES (To run regression for RES devices)"
# @echo "... clean (To clean all old runs) "

.PHONY : help
51 changes: 51 additions & 0 deletions models/ngspice/testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Globalfoundries 180nm MCU models-ngspice regression

Explains how to run GF180nm models-ngspice regression.

## Folder Structure

```text
📦testing
┣ 📜Makefile
┣ 📜README.md
┣ 📦regression
┣ 📦smoke_test
┣ 📦180MCU_SPICE_Models
```

## Prerequisites

At a minimum:

- Git 2.35+
- Python 3.6+
- ngspice-36+

### On Ubuntu, you can just

`apt install -y build-essential python3`

- Check this [ngspice](http://ngspice.sourceforge.net/download.html) for ngspice installation.

## Regression Usage

To make a full test for GF180nm models-ngspice, you could use the following command in testing directory:

```bash
make all
```

- You could also check allowed targets in the Makefile, using the following command:

```bash
make help
```

## **Regression Outputs**

- The resulting files are in `regression/<device_folder>/` with name of `<device_name><options>` that contains:

1. A final report file of all results.
2. measured folder that contains measured data used in regression.
3. simulated folder that contains simulated data used in regression.
4. netlists folder that contains spice files used in simulation.
2 changes: 2 additions & 0 deletions models/ngspice/testing/regression/.spiceinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
************
set ngbehavior=hs
2 changes: 2 additions & 0 deletions models/ngspice/testing/regression/bjt_beta/.spiceinit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
************
set ngbehavior=hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
*****************
** main netlist
*****************

Vcp c 0 dc 3
Vbp b 0 dc 1.2

.temp {{temp}}
.options tnom={{temp}}

xq1 c b 0 0 {{device}}


*****************
** Analysis
*****************

.control
set filetype=ascii

dc Vbp 0.2 1.2 0.01 Vcp 1 3 1
wrdata npn/simulated_Ic/{{i}}_simulated_{{device}}.csv -i(Vcp)
wrdata npn/simulated_Ib/{{i}}_simulated_{{device}}.csv -i(Vbp)
.endc

.include "../../../design.ngspice"
.lib "../../../sm141064.ngspice" bjt_typical

.end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
*****************
** main netlist
*****************

Vcp c 0 dc -3
Vbp b 0 dc -1.2

.temp {{temp}}
.options tnom={{temp}}

xq1 c b 0 {{device}}


*****************
** Analysis
*****************

.control
set filetype=ascii

dc Vbp -0.2 -1.2 -0.01 Vcp -1 -3 -1
wrdata pnp/simulated_Ic/{{i}}_simulated_{{device}}.csv i(Vcp)
wrdata pnp/simulated_Ib/{{i}}_simulated_{{device}}.csv i(Vbp)
.endc

.include "../../../design.ngspice"
.lib "../../../sm141064.ngspice" bjt_typical

.end
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

*****************
** main netlist
*****************

Vcp c 0 dc 3
*Ib 0 b 9u
Vbp b 0 dc 1.2

.temp 25
.options tnom=25

xq1 c b 0 0 vnpn_10x10


*****************
** Analysis
*****************

.control
set filetype=ascii

dc Vbp 0.2 1.2 0.01 Vcp 1 3 1
print -i(Vcp)
print -i(Vbp)
wrdata result.csv -i(Vcp)
wrdata result.csv -i(Vbp)
.endc

.include "../../../design.ngspice"
.lib "../../../sm141064.ngspice" bjt_typical

.end

0 comments on commit 5818a3c

Please sign in to comment.