Code Monkey home page Code Monkey logo

charlib's People

Contributors

anirudhmahajan05 avatar infinitymdm avatar stineje avatar thesourcerer8 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

charlib's Issues

LICENSE might be wrong?

In the README you say;

This open-source characterization tool is modified from the libretto characterization tool found here : https://github.com/snishizawa/libretto.

libretto is licensed under the GPL v2.0 license (see https://github.com/snishizawa/libretto/blob/main/LICENSE). If this code is a derivative work of libretto, then it needs to also be released under the same license.

As well, if this tool is derivative work of libretto, then we should be contributing the changes to libretto rather than creating a fork.

spice model parameters

If I specify the typical parameter to a model, it seems to be handled as a tuple value, but then it crashes:

models:
        - ../Tech.GF180MCU/sm141064.ngspice typical # This syntax tells CharLib to use the '.lib file section' syntax for this model
        - ../Tech.GF180MCU/design.ngspice

This is the result:

Searching for YAML files in .
Reading configuration found in "libresilicon-charlib.yml"
Prefixed unit not found for 1e-15 J and power -15
Prefixed unit not found for 1e-15 J and power -15
Recognized INV pin Y function as INV
Recognized MARTIN1989 pin C function as OR2
Running input_capacitance for pin A of cell INV
Traceback (most recent call last):
File "/home/philipp/.local/lib/python3.10/site-packages/PySpice/Spice/Netlist.py", line 928, in getattr
return self.getitem(attribute_name)
File "/home/philipp/.local/lib/python3.10/site-packages/PySpice/Spice/Netlist.py", line 921, in getitem
raise IndexError(attribute_name) # KeyError
IndexError: lib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/philipp/.local/bin/charlib", line 8, in
sys.exit(main())
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/run.py", line 60, in main
args.func(args)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/run.py", line 127, in run_charlib
library = characterizer.characterize()
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Characterizer.py", line 39, in characterize
cells = [self.characterize_cell(cell) for cell in self.tests]
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Characterizer.py", line 39, in
cells = [self.characterize_cell(cell) for cell in self.tests]
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Characterizer.py", line 48, in characterize_cell
return cell.characterize(self.settings)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/TestManager.py", line 307, in characterize
input_capacitance = self._run_input_capacitance(settings, pin.name) @ u_F
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/TestManager.py", line 256, in _run_input_capacitance
self._include_models(circuit)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/TestManager.py", line 139, in _include_models
circuit.lib(*model)
File "/home/philipp/.local/lib/python3.10/site-packages/PySpice/Spice/Netlist.py", line 930, in getattr
raise AttributeError(attribute_name)
AttributeError: lib

If I remove the "typical", it continues running.

Incorrect indexes in Liberty file (timing constraint group)

After test run I see that templates in Liberty file:
lu_table_template (hold_template_5x5) {
variable_1 : related_pin_transition;
variable_2 : constrained_pin_transition;
index_1 ("0.015, 0.04, 0.08, 0.2, 0.4");
index_2 ("0.06, 0.18, 0.42, 0.6, 1.2");
}
lu_table_template (setup_template_5x5) {
variable_1 : related_pin_transition;
variable_2 : constrained_pin_transition;
index_1 ("0.015, 0.04, 0.08, 0.2, 0.4");
index_2 ("0.06, 0.18, 0.42, 0.6, 1.2");
}
lu_table_template (delay_template_5x5) {
variable_1 : input_net_transition;
variable_2 : total_output_net_capacitance;
index_1 ("0.015, 0.04, 0.08, 0.2, 0.4");
index_2 ("0.06, 0.18, 0.42, 0.6, 1.2");
}

index_2 in "delay" section numerically equal index_2 in "setup" and "hold" section. This behavior doesn't match Liberty standard.
I see two ways to solve this problem:

  1. Make index_2 in "setup" and "hold" section equal to index_1, because in this case both indexes refer to slews (data and clock)
  2. Add way to set array of clock slews separately

Installation

What is the goal regarding the installation of CharLib? Is CharLib.py going to be installed somewhere in $PATH, so that it can be called? Should a flow that uses CharLib ship CharLib with it? Should CharLib be referenced as a submodule? Is CharLib going to be provided through the pip installer?

problem testing gf180

When trying these commands:

pip install charlib
git clone https://github.com/stineje/CharLib/
cd CharLib
test/gf180/fetch_spice.sh
charlib run test/gf180

I get this output:

Searching for YAML files in test/gf180/
Reading configuration found in "test/gf180/gf180.yml"
Prefixed unit not found for 1e-15 J and power -15
Prefixed unit not found for 1e-15 J and power -15
Recognized GF180MCU_OSU_SC_GP12T3V3__INV_1 pin Y function as INV
Recognized GF180MCU_OSU_SC_GP12T3V3__AND2_1 pin Y function as AND2
Recognized GF180MCU_OSU_SC_GP12T3V3__XNOR2_1 pin Y function as XNOR2
Recognized GF180MCU_OSU_SC_GP12T3V3__DFF_1 pin Q function as BUF
Recognized GF180MCU_OSU_SC_GP12T3V3__DFF_1 pin QN function as INV
Recognized GF180MCU_OSU_SC_GP12T3V3__DFFSR_1 pin Q function as BUF
Recognized GF180MCU_OSU_SC_GP12T3V3__DFFSR_1 pin QN function as INV
Running input_capacitance for pin A of cell GF180MCU_OSU_SC_GP12T3V3__INV_1
Traceback (most recent call last):
File "/home/philipp/.local/lib/python3.10/site-packages/PySpice/Spice/Netlist.py", line 928, in getattr
return self.getitem(attribute_name)
File "/home/philipp/.local/lib/python3.10/site-packages/PySpice/Spice/Netlist.py", line 921, in getitem
raise IndexError(attribute_name) # KeyError
IndexError: lib

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/philipp/.local/bin/charlib", line 8, in
sys.exit(main())
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/run.py", line 60, in main
args.func(args)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/run.py", line 127, in run_charlib
library = characterizer.characterize()
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Characterizer.py", line 39, in characterize
cells = [self.characterize_cell(cell) for cell in self.tests]
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Characterizer.py", line 39, in
cells = [self.characterize_cell(cell) for cell in self.tests]
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Characterizer.py", line 48, in characterize_cell
return cell.characterize(self.settings)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/TestManager.py", line 307, in characterize
input_capacitance = self._run_input_capacitance(settings, pin.name) @ u_F
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/TestManager.py", line 256, in _run_input_capacitance
self._include_models(circuit)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/TestManager.py", line 139, in _include_models
circuit.lib(*model)
File "/home/philipp/.local/lib/python3.10/site-packages/PySpice/Spice/Netlist.py", line 930, in getattr
raise AttributeError(attribute_name)
AttributeError: lib

Add option to show plots for characterization

Add options to generate plots that show the details of what's happening during characterization, as well as a nicer view of characterization results.

@stineje and I discussed the following plots as a good starting point:

  • For timing characterization
    • I/O voltages vs. time
    • Transport and Propagation delay vs fanout (displayed as a 3D surface plot)
  • For power characterization
    • [ ] Power vs. fanout Moved to #14

function parsing problem

It seems to me that the negation operator ! which should have the highest priority isn't working properly, only when I add round brackets around the term that is negated, the error goes away:
libresilicon-charlib.yml.txt

Searching for YAML files in .
Reading configuration found in "libresilicon-charlib.yml"
Prefixed unit not found for 1e-15 J and power -15
Prefixed unit not found for 1e-15 J and power -15
Traceback (most recent call last):
File "/home/philipp/.local/bin/charlib", line 8, in
sys.exit(main())
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/run.py", line 60, in main
args.func(args)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/run.py", line 122, in run_charlib
characterizer.add_cell(name, inputs, outputs, functions, **properties)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Characterizer.py", line 21, in add_cell
CombinationalTestManager(name, in_ports, out_ports, functions, **kwargs)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/TestManager.py", line 61, in init
if reg_func == function:
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/functions/functions.py", line 68, in eq
result = self.truth_table() == other.truth_table()
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/functions/functions.py", line 60, in truth_table
result = self.eval(**dict(zip(self.operands, input_vector)))
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/functions/functions.py", line 51, in eval
f = eval(f'lambda {",".join(operands)}: int({self.expression.replace("~", " not ")})')
File "", line 1
lambda B,A,A1,C1,C,B1: int( not (C1&( not C)&B1&B&( not A1)&( not A)|C1&C&B1&B& not A1& not A| not C1&C&B1&B& not A1& not A| not C1&C&B1&B&A1& not A|C1&C&B1&B&A1& not A|C1& not C&B1&B&A1& not A|C1& not C& not B1& not B&A1&A|C1&C& not B1& not B&A1&A| not C1&C& not B1& not B&A1&A| not C1&C&B1& not B&A1&A|C1&C&B1& not B&A1&A|C1& not C&B1& not B&A1&A|C1& not C&B1&B&A1&A|C1&C&B1&B&A1&A| not C1&C&B1&B&A1&A| not C1&C& not B1&B&A1&A|C1&C& not B1&B&A1&A|C1& not C& not B1&B&A1&A| not C1&C&B1&B& not A1&A|C1&C&B1&B& not A1&A|C1& not C&B1&B& not A1&A))
^^^
SyntaxError: invalid syntax

problem testing osu350

When I run

test/osu350/fetch_spice.sh
charlib run test/osu350/

I get the following outputs:

Searching for YAML files in test/osu350/
Reading configuration found in "test/osu350/osu350.yml"
Prefixed unit not found for 1e-15 J and power -15
Prefixed unit not found for 1e-15 J and power -15
Recognized AND2X1 pin Y function as AND2
Recognized AND2X2 pin Y function as AND2
Recognized BUFX2 pin Y function as BUF
...
Recognized XOR2X1 pin Y function as XOR2
Running input_capacitance for pin A of cell AND2X1
2023-12-11 19:02:29,961 - PySpice.Spice.NgSpice.Shared.NgSpiceShared._send_char - ERROR - Note: can't find init file.
Running input_capacitance for pin B of cell AND2X1
Running delay AND2X1 A=01 B=1 Y=01 with slew=0.015 ns, load=0.06 pF
Running delay AND2X1 A=01 B=1 Y=01 with slew=0.015 ns, load=0.18 pF
...
Running delay AND2X1 B=10 A=1 Y=10 with slew=0.4 ns, load=1.2 pF
Traceback (most recent call last):
File "/home/philipp/.local/lib/python3.10/site-packages/PySpice/Probe/WaveForm.py", line 294, in getitem
return self._get_item(name)
File "/home/philipp/.local/lib/python3.10/site-packages/PySpice/Probe/WaveForm.py", line 288, in _get_item
raise IndexError(name)
IndexError: prop_in_out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/philipp/.local/bin/charlib", line 8, in
sys.exit(main())
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/run.py", line 60, in main
args.func(args)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/run.py", line 127, in run_charlib
library = characterizer.characterize()
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Characterizer.py", line 39, in characterize
cells = [self.characterize_cell(cell) for cell in self.tests]
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Characterizer.py", line 39, in
cells = [self.characterize_cell(cell) for cell in self.tests]
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Characterizer.py", line 48, in characterize_cell
return cell.characterize(self.settings)
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/TestManager.py", line 339, in characterize
if worst_case_harness.average_propagation_delay() < harness.average_propagation_delay():
File "/home/philipp/.local/lib/python3.10/site-packages/charlib/characterizer/Harness.py", line 139, in average_propagation_delay
total_delay += self.results[slope][load]['prop_in_out'] @ u_s
File "/home/philipp/.local/lib/python3.10/site-packages/PySpice/Probe/WaveForm.py", line 296, in getitem
return self._get_item(name.lower())
File "/home/philipp/.local/lib/python3.10/site-packages/PySpice/Probe/WaveForm.py", line 288, in _get_item
raise IndexError(name)
IndexError: prop_in_out

Goals and Intended Features

This issue tracks major goals and features for CharLib. Other issues and PRs will be linked here as features are completed or worked towards.

  • Support combinational and sequential cells
  • Take advantage of multithreading (WIP: see #19 )
  • Characterize timing, power, and noise
  • Provide CCSM, ECSM, and NLDM models
  • Account for setup and hold time interdependence in sequential characterization
  • Support HSPICE as a circuit simulator

Feedback and suggestions are, of course, welcome.

work directory

Please automatically create the work directory when it is missing.
Please add a commandline option to specify the name/path of the work directory.

Sequential Cells characterization issues

At present, sequential cell characterization doesn't work correctly. This is because a) there isn't infrastructure for generating sequential test vectors and b) there is only minimal infrastructure for attaching Harnesses to sequential cells.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.