Skip to content

Commit d1d2b61

Browse files
authored
Merge pull request #104 from siliconcompiler/filesets
Updating lambdalib for new SC design API
2 parents ba7806b + 3cb7fc0 commit d1d2b61

File tree

356 files changed

+3509
-780
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

356 files changed

+3509
-780
lines changed

.flake8

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
[flake8]
22
max-line-length = 100
33
extend-exclude = build,.venv
4-
extend-ignore =
4+
extend-ignore =
5+
per-file-ignores =
6+
lambdalib/__init__.py:F401

.gitignore

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
21
#Editor files
32
*~
4-
*~
3+
4+
.vscod
5+
6+
#Env
7+
venv/
8+
.venv
9+
10+
11+
# Sim
512
*.log
6-
tmp*
7-
a.out
813
*.vcd
9-
.venv/
14+
a.out
15+
*.vvp
16+
*.f
1017

1118
# Byte-compiled / optimized / DLL files
1219
__pycache__/

README.md

Lines changed: 47 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,66 @@
11
# Lambdalib Introduction
22

3-
Lambdalib is a modular hardware abstraction library which decouples design from the underlying manufacturing target. Lambdalib defines a set of generic functions that get resolved during the target technology mapping stage.
3+
Lambdalib is a modular hardware abstraction library which decouples design from the manufacturing target. The project was inspired by the `Lambda` concept invented during the [1978 VLSI revolution by Mead and Conway](https://en.wikipedia.org/wiki/Mead%E2%80%93Conway_VLSI_chip_design_revolution).
44

5-
Lambdalib includes the following hardware categories:
5+
The original single value Lambda approach no longer applies to modern CMOS manufacturing, so Lambdalib has raised the abstraction level to the cell/block level to enable automated porting between compilation targets.
6+
7+
Lambdalib abstracts away technology specific design modules that cannot be cleanly expressed in technology agnostic RTL Verilog code (eg. synchronizers, analog circuits, io cells, etc.)
8+
9+
The table below summarizes the categories of cells available.
610

711
| Category | Description |
812
|-------------------------------------|---------------------------------------|
913
|[stdlib](lambdalib/stdlib/rtl) | Standard cells (inv, nand, ff, ...)
10-
|[auxlib](lambdalib/auxlib/rtl) | Aux cells can consist of multiple standard cells or physical only cells
14+
|[auxlib](lambdalib/auxlib/rtl) | Special cells (antenna, decap, clkmux,...)
1115
|[ramlib](lambdalib/ramlib/rtl) | Memory (single port, dual port, fifo, ...)
1216
|[iolib](lambdalib/iolib) | IO cells (bidir, vdd, clamp,...)
1317
|[padring](lambdalib/padring) | Padring generator
14-
|[vectorlib](lambdalib/vectorlib/rtl) | Vectorized library (mux, isolation)
18+
|[veclib](lambdalib/veclib/rtl) | Vectorized datapath cells (mux, buf,..)
1519
|[fpgalib](lambdalib/fpgalib/rtl) | FPGA cells (lut4, ble, clb)
1620

1721
The [Lambdapdk](https://github.com/siliconcompiler/lambdapdk) repository demonstrates implementation of the Lambdalib interfaces across a number of open source process technologies.
1822

1923
Lambdalib has been successfully used in multiple tapeouts using [SiliconCompiler](https://github.com/siliconcompiler/siliconcompiler).
2024

25+
# Installation
26+
27+
```bash
28+
git clone https://github.com/zeroasiccorp/lambdalib
29+
cd lambdalib
30+
pip install --upgrade pip
31+
pip install -e .
32+
```
33+
34+
# Examples
35+
36+
## Instantiating a Lambdalib module
37+
38+
This example shows how to instantiate the Padring module in a top level chip design.
39+
We could have chosen any module to instantiate (inverter, flip flop, dual port ram...).
40+
41+
42+
```python
43+
```
44+
45+
To convert the design into a gate level netlist using yosys, just run python script
46+
in the examples folder. A file `chip.vg` will be written to disk in the run directory.
47+
48+
```bash
49+
$ python examples/padring/make.py
50+
```
51+
52+
## Using SiliconCompiler to target a technology
53+
54+
```python
55+
```
56+
57+
58+
# Project Methodology
59+
60+
- One verilog module per RTL file
61+
- One Python module per reusable module
62+
- Class names are RTL module names with "la_" removed and capitalized
63+
2164
# License
2265

2366
[MIT](LICENSE)

examples/chip/chip.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import subprocess
2+
3+
from siliconcompiler import DesignSchema
4+
5+
from lambdalib.padring import Padring
6+
7+
8+
class Chip(DesignSchema):
9+
def __init__(self):
10+
11+
name = 'chip'
12+
super().__init__(name)
13+
14+
fileset = 'rtl'
15+
dataroot = f'{name}'
16+
topmodule = name
17+
18+
self.set_dataroot(dataroot, __file__)
19+
self.set_topmodule(topmodule, fileset)
20+
21+
self.add_file("rtl/chip.v", fileset, dataroot=dataroot)
22+
self.add_idir('rtl', fileset, dataroot=dataroot)
23+
24+
# dependencies
25+
self.add_depfileset(Padring(), depfileset='rtl', fileset='rtl')
26+
27+
28+
if __name__ == "__main__":
29+
d = Chip()
30+
d.write_fileset(f"{d.name}.f", fileset="rtl")
31+
cmd = ['yosys', '-f', f"{d.name}.f"]
32+
subprocess.run(cmd, stderr=subprocess.STDOUT, check=True)

examples/chip/rtl/chip.v

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
module chip #(parameter NO_NPINS = 16,
2+
parameter EA_NPINS = 16,
3+
parameter WE_NPINS = 16,
4+
parameter SO_NPINS = 16)
5+
(
6+
input VSS,
7+
input VDD,
8+
input NVCC,
9+
input EVCC,
10+
input WVCC,
11+
input SVCC,
12+
inout [NO_NPINS-1:0] NIO,
13+
inout [EA_NPINS-1:0] EIO,
14+
inout [WE_NPINS-1:0] WIO,
15+
inout [SO_NPINS-1:0] SIO
16+
);
17+
18+
`include "chip_iomap.vh"
19+
20+
wire [NO_NSECTIONS*RINGW-1:0] no_ioring;
21+
wire [EA_NSECTIONS*RINGW-1:0] ea_ioring;
22+
wire [WE_NSECTIONS*RINGW-1:0] we_ioring;
23+
wire [SO_NSECTIONS*RINGW-1:0] so_ioring;
24+
25+
wire [NO_NPINS-1:0] no_rxd;
26+
wire [EA_NPINS-1:0] ea_rxd;
27+
wire [WE_NPINS-1:0] we_rxd;
28+
wire [SO_NPINS-1:0] so_rxd;
29+
30+
la_padring #(// padring ctrl widths
31+
.RINGW(RINGW),
32+
.CFGW(CFGW),
33+
//north
34+
.NO_NPINS(NO_NPINS),
35+
.NO_NCELLS(NO_NCELLS),
36+
.NO_NSECTIONS(NO_NSECTIONS),
37+
.NO_CELLMAP(NO_CELLMAP),
38+
//east
39+
.EA_NPINS(EA_NPINS),
40+
.EA_NCELLS(EA_NCELLS),
41+
.EA_NSECTIONS(EA_NSECTIONS),
42+
.EA_CELLMAP(EA_CELLMAP),
43+
//south
44+
.SO_NPINS(SO_NPINS),
45+
.SO_NCELLS(SO_NCELLS),
46+
.SO_NSECTIONS(SO_NSECTIONS),
47+
.SO_CELLMAP(SO_CELLMAP),
48+
//west
49+
.WE_NPINS(WE_NPINS),
50+
.WE_NCELLS(WE_NCELLS),
51+
.WE_NSECTIONS(WE_NSECTIONS),
52+
.WE_CELLMAP(WE_CELLMAP))
53+
la_padring(// Outputs
54+
.no_zp (no_rxd[NO_NPINS-1:0]),
55+
.no_zn (),
56+
.ea_zp (ea_rxd[EA_NPINS-1:0]),
57+
.ea_zn (),
58+
.so_zp (so_rxd[SO_NPINS-1:0]),
59+
.so_zn (),
60+
.we_zp (we_rxd[WE_NPINS-1:0]),
61+
.we_zn (),
62+
// Inouts
63+
.vss (VSS),
64+
.no_pad (NIO),
65+
.no_aio (),
66+
.no_vdd (VDD),
67+
.no_vddio (NVCC),
68+
.no_vssio (VSS),
69+
.no_ioring (no_ioring[NO_NSECTIONS*RINGW-1:0]),
70+
.ea_pad (EIO),
71+
.ea_aio (),
72+
.ea_vdd (VDD),
73+
.ea_vddio (EVCC),
74+
.ea_vssio (VSS),
75+
.ea_ioring (ea_ioring[EA_NSECTIONS*RINGW-1:0]),
76+
.so_pad (SIO),
77+
.so_aio (),
78+
.so_vdd (VDD),
79+
.so_vddio (SVCC),
80+
.so_vssio (VSS),
81+
.so_ioring (so_ioring[SO_NSECTIONS*RINGW-1:0]),
82+
.we_pad (WIO),
83+
.we_aio (),
84+
.we_vdd (VDD),
85+
.we_vddio (WVCC),
86+
.we_vssio (VSS),
87+
.we_ioring (we_ioring[WE_NSECTIONS*RINGW-1:0]),
88+
// Inputs
89+
.no_a ({NO_NPINS{1'b0}}),
90+
.no_ie ({NO_NPINS{1'b1}}),
91+
.no_oe ({NO_NPINS{1'b0}}),
92+
.no_pe ({NO_NPINS{1'b0}}),
93+
.no_ps ({NO_NPINS{1'b0}}),
94+
.no_cfg ({(NO_NPINS*CFGW){1'b0}}),
95+
.ea_a ({EA_NPINS{1'b0}}),
96+
.ea_ie ({EA_NPINS{1'b1}}),
97+
.ea_oe ({EA_NPINS{1'b0}}),
98+
.ea_pe ({EA_NPINS{1'b0}}),
99+
.ea_ps ({EA_NPINS{1'b0}}),
100+
.ea_cfg ({(EA_NPINS*CFGW){1'b0}}),
101+
.we_a ({WE_NPINS{1'b0}}),
102+
.we_ie ({WE_NPINS{1'b1}}),
103+
.we_oe ({WE_NPINS{1'b0}}),
104+
.we_pe ({WE_NPINS{1'b0}}),
105+
.we_ps ({WE_NPINS{1'b0}}),
106+
.we_cfg ({(WE_NPINS*CFGW){1'b0}}),
107+
.so_a ({SO_NPINS{1'b0}}),
108+
.so_ie ({SO_NPINS{1'b1}}),
109+
.so_oe ({SO_NPINS{1'b0}}),
110+
.so_pe ({SO_NPINS{1'b0}}),
111+
.so_ps ({SO_NPINS{1'b0}}),
112+
.so_cfg ({(SO_NPINS*CFGW){1'b0}})
113+
);
114+
115+
endmodule

examples/chip/rtl/chip_iomap.vh

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
//########################################################################
2+
// Common Padring Definitions
3+
//########################################################################
4+
5+
`include "la_padring.vh"
6+
7+
//########################################################################
8+
// Total number of IO cells in one padring side (including power)
9+
//########################################################################
10+
11+
// 16 bidirs
12+
// 12 power ground
13+
// 2 cut cells
14+
// 1 poc
15+
16+
localparam NCELLS = 31;
17+
18+
//########################################################################
19+
// Power sections per side
20+
//########################################################################
21+
22+
localparam NSECTIONS = 1;
23+
24+
//########################################################################
25+
// Tech specific iolib parameters
26+
//########################################################################
27+
28+
// total width of config bus (drive strength, schmitt, ...)
29+
localparam CFGW = 6;
30+
31+
// width of bus that goes around ioring
32+
localparam RINGW = 6;
33+
34+
//########################################################################
35+
// CELLMAP[NCELLS*40-1:0] = {PROP, SECTION, CELL, CPIN#, PIN#}
36+
//########################################################################
37+
38+
/* The CELLMAP vector specifies the type, order, power rail, and pin
39+
* connection for each cell placed in a side of the io padring.
40+
*
41+
* CELLMAP is used by la_padside which iterates from 0 to NCELLS-1 to
42+
* instantiate padring cells. The index for that for loop is used
43+
* to find the power section, pin number, and cell type in the
44+
* static definition below. The indices of the cells are specified from
45+
* left to right or top to bottom. The CELLMAP[0] is the first cell
46+
* placed.
47+
*
48+
* All enumerationsa arer defined in the la_iopadring.vh
49+
*
50+
* [7:0] PIN# = pin# (order 0-255)
51+
* [15:8] COMPLEMENT PIN# = pin# (order 0-255)
52+
* [23:16] CELL = cell type from lambdalib (0-255)
53+
* [31:24] SECTION = power rail selector (when NSECTIONS>1)
54+
* [39:32] PROP = cell property (optional)
55+
*
56+
*/
57+
58+
localparam [NCELLS*40-1:0] CELLMAP =
59+
{{NULL, NULL, LA_CUT, NULL, NULL},
60+
{NULL, NULL, LA_BIDIR, NULL, PIN15},
61+
{NULL, NULL, LA_BIDIR, NULL, PIN14},
62+
{NULL, NULL, LA_BIDIR, NULL, PIN13},
63+
{NULL, NULL, LA_BIDIR, NULL, PIN12},
64+
{NULL, NULL, LA_VSS, NULL, NULL},
65+
{NULL, NULL, LA_VDD, NULL, NULL},
66+
{NULL, NULL, LA_VDDIO, NULL, NULL},
67+
{NULL, NULL, LA_VSSIO, NULL, NULL},
68+
{NULL, NULL, LA_BIDIR, NULL, PIN11},
69+
{NULL, NULL, LA_BIDIR, NULL, PIN10},
70+
{NULL, NULL, LA_BIDIR, NULL, PIN9},
71+
{NULL, NULL, LA_BIDIR, NULL, PIN8},
72+
{NULL, NULL, LA_VSS, NULL, NULL},
73+
{NULL, NULL, LA_VDD, NULL, NULL},
74+
{NULL, NULL, LA_POC, NULL, NULL},
75+
{NULL, NULL, LA_VDDIO, NULL, NULL},
76+
{NULL, NULL, LA_VSSIO, NULL, NULL},
77+
{NULL, NULL, LA_BIDIR, NULL, PIN7},
78+
{NULL, NULL, LA_BIDIR, NULL, PIN6},
79+
{NULL, NULL, LA_BIDIR, NULL, PIN5},
80+
{NULL, NULL, LA_BIDIR, NULL, PIN4},
81+
{NULL, NULL, LA_VSS, NULL, NULL},
82+
{NULL, NULL, LA_VDD, NULL, NULL},
83+
{NULL, NULL, LA_VDDIO, NULL, NULL},
84+
{NULL, NULL, LA_VSSIO, NULL, NULL},
85+
{NULL, NULL, LA_BIDIR, NULL, PIN3},
86+
{NULL, NULL, LA_BIDIR, NULL, PIN2},
87+
{NULL, NULL, LA_BIDIR, NULL, PIN1},
88+
{NULL, NULL, LA_BIDIR, NULL, PIN0},
89+
{NULL, NULL, LA_CUT, NULL, NULL}};
90+
91+
//########################################################################
92+
// Symmetrical padring for simplicity (not a restriction)
93+
//########################################################################
94+
95+
localparam NO_NCELLS = NCELLS;
96+
localparam EA_NCELLS = NCELLS;
97+
localparam WE_NCELLS = NCELLS;
98+
localparam SO_NCELLS = NCELLS;
99+
100+
localparam NO_NSECTIONS = NSECTIONS;
101+
localparam EA_NSECTIONS = NSECTIONS;
102+
localparam WE_NSECTIONS = NSECTIONS;
103+
localparam SO_NSECTIONS = NSECTIONS;
104+
105+
localparam NO_CELLMAP = CELLMAP;
106+
localparam EA_CELLMAP = CELLMAP;
107+
localparam WE_CELLMAP = CELLMAP;
108+
localparam SO_CELLMAP = CELLMAP;

examples/sram/rtl/sram.v

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module sram();
2+
3+
// TODO: put in la_spram
4+
5+
endmodule

0 commit comments

Comments
 (0)