najaeda 0.1.3__cp313-cp313t-macosx_11_0_arm64.whl → 0.1.5__cp313-cp313t-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of najaeda might be problematic. Click here for more details.
- najaeda/instance_visitor.py +45 -0
- najaeda/libnaja_snl_python.dylib +0 -0
- najaeda/netlist.py +25 -5
- najaeda/primitives/__init__.py +0 -0
- najaeda/primitives/xilinx.py +452 -0
- najaeda/snl.so +0 -0
- {najaeda-0.1.3.dist-info → najaeda-0.1.5.dist-info}/METADATA +38 -8
- najaeda-0.1.5.dist-info/RECORD +13 -0
- {najaeda-0.1.3.dist-info → najaeda-0.1.5.dist-info}/licenses/AUTHORS +2 -1
- najaeda/.dylibs/PythonT +0 -0
- najaeda-0.1.3.dist-info/RECORD +0 -11
- {najaeda-0.1.3.dist-info → najaeda-0.1.5.dist-info}/WHEEL +0 -0
- {najaeda-0.1.3.dist-info → najaeda-0.1.5.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 The Naja authors
|
|
2
|
+
# <https://github.com/najaeda/naja/blob/main/AUTHORS>
|
|
3
|
+
#
|
|
4
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
|
|
6
|
+
from typing import Callable
|
|
7
|
+
from najaeda import netlist
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class VisitorConfig:
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
enter_condition: Callable[[netlist.Instance], bool] = lambda node: True,
|
|
14
|
+
callback: Callable[[netlist.Instance], None] = lambda node: None,
|
|
15
|
+
):
|
|
16
|
+
"""
|
|
17
|
+
:param enter_condition: A function that determines whether to visit
|
|
18
|
+
the children of an instance.
|
|
19
|
+
:param callback: The callback to be executed when an instance is visited.
|
|
20
|
+
"""
|
|
21
|
+
self.callback = callback
|
|
22
|
+
self.enter_condition = enter_condition
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class Visitor:
|
|
26
|
+
def __init__(self, instance: netlist.Instance):
|
|
27
|
+
"""
|
|
28
|
+
:param netlist: The hierarchical netlist to be traversed.
|
|
29
|
+
"""
|
|
30
|
+
self.instance = instance
|
|
31
|
+
|
|
32
|
+
def visit(self, instance: netlist.Instance, config: VisitorConfig):
|
|
33
|
+
"""
|
|
34
|
+
Recursively visits nodes in the netlist hierarchy.
|
|
35
|
+
|
|
36
|
+
:param instance: The current node in the netlist instance hierarchy.
|
|
37
|
+
:param config: VisitorConfig object defining conditions and callbacks.
|
|
38
|
+
"""
|
|
39
|
+
# Execute the callback
|
|
40
|
+
config.callback(instance)
|
|
41
|
+
|
|
42
|
+
# Check if we should proceed to children
|
|
43
|
+
if config.enter_condition(instance):
|
|
44
|
+
for child in instance.get_child_instances():
|
|
45
|
+
self.visit(child, config)
|
najaeda/libnaja_snl_python.dylib
CHANGED
|
Binary file
|
najaeda/netlist.py
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
# SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
|
|
6
6
|
import itertools
|
|
7
|
+
import time
|
|
7
8
|
import logging
|
|
8
9
|
|
|
9
10
|
from najaeda import snl
|
|
@@ -34,13 +35,13 @@ class Equipotential:
|
|
|
34
35
|
|
|
35
36
|
def get_top_terms(self):
|
|
36
37
|
for term in self.equi.getTerms():
|
|
37
|
-
yield Term(snl.SNLPath(), term
|
|
38
|
+
yield Term(snl.SNLPath(), term)
|
|
38
39
|
|
|
39
40
|
def get_all_leaf_readers(self):
|
|
40
41
|
for term in self.equi.getInstTermOccurrences():
|
|
41
42
|
direction = term.getInstTerm().getDirection()
|
|
42
43
|
if direction != snl.SNLTerm.Direction.Output:
|
|
43
|
-
if term.getInstTerm().getInstance().getModel().
|
|
44
|
+
if term.getInstTerm().getInstance().getModel().isLeaf():
|
|
44
45
|
yield Term(
|
|
45
46
|
snl.SNLPath(term.getPath(), term.getInstTerm().getInstance()),
|
|
46
47
|
term.getInstTerm().getBitTerm(),
|
|
@@ -160,14 +161,14 @@ class Net:
|
|
|
160
161
|
path = snl.SNLPath(self.path, term.getInstance())
|
|
161
162
|
yield Term(path, term.getBitTerm())
|
|
162
163
|
|
|
163
|
-
def
|
|
164
|
+
def get_design_terms(self):
|
|
164
165
|
if hasattr(self, "net_concat"):
|
|
165
166
|
raise ValueError("Cannot get terms from a net_concat")
|
|
166
167
|
for term in self.net.getBitTerms():
|
|
167
168
|
yield Term(self.path, term)
|
|
168
169
|
|
|
169
|
-
def
|
|
170
|
-
for term in itertools.chain(self.
|
|
170
|
+
def get_terms(self):
|
|
171
|
+
for term in itertools.chain(self.get_design_terms(), self.get_inst_terms()):
|
|
171
172
|
yield term
|
|
172
173
|
|
|
173
174
|
|
|
@@ -451,6 +452,10 @@ class Instance:
|
|
|
451
452
|
"""Return True if this is a blackbox."""
|
|
452
453
|
return self.__get_snl_model().isBlackBox()
|
|
453
454
|
|
|
455
|
+
def is_leaf(self) -> bool:
|
|
456
|
+
"""Return True if this is a leaf."""
|
|
457
|
+
return self.__get_snl_model().isLeaf()
|
|
458
|
+
|
|
454
459
|
def is_const0(self) -> bool:
|
|
455
460
|
"""Return True if this is a constant 0 generator."""
|
|
456
461
|
return self.__get_snl_model().isConst0()
|
|
@@ -700,14 +705,29 @@ def create_top(name: str) -> Instance:
|
|
|
700
705
|
|
|
701
706
|
|
|
702
707
|
def load_verilog(files: list):
|
|
708
|
+
start_time = time.time()
|
|
709
|
+
logging.info(f"Loading verilog: {', '.join(files)}")
|
|
703
710
|
get_top_db().loadVerilog(files)
|
|
711
|
+
execution_time = time.time() - start_time
|
|
712
|
+
logging.info(f"Loading done in {execution_time:.2f} seconds")
|
|
704
713
|
return get_top()
|
|
705
714
|
|
|
706
715
|
|
|
707
716
|
def load_liberty(files: list):
|
|
717
|
+
logging.info(f"Loading liberty: {', '.join(files)}")
|
|
708
718
|
get_top_db().loadLibertyPrimitives(files)
|
|
709
719
|
|
|
710
720
|
|
|
721
|
+
def load_primitives(name: str):
|
|
722
|
+
if name == "xilinx":
|
|
723
|
+
logging.info("Loading xilinx primitives")
|
|
724
|
+
from najaeda.primitives import xilinx
|
|
725
|
+
|
|
726
|
+
xilinx.load(get_top_db())
|
|
727
|
+
else:
|
|
728
|
+
raise ValueError(f"Unknown primitives library: {name}")
|
|
729
|
+
|
|
730
|
+
|
|
711
731
|
def get_primitives_library() -> snl.SNLLibrary:
|
|
712
732
|
lib = get_top_db().getLibrary("PRIMS")
|
|
713
733
|
if lib is None:
|
|
File without changes
|
|
@@ -0,0 +1,452 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2024 The Naja authors <https://github.com/najaeda/naja/blob/main/AUTHORS>
|
|
2
|
+
#
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
|
|
5
|
+
from najaeda import snl
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def constructIBUF(lib):
|
|
9
|
+
ibuf = snl.SNLDesign.createPrimitive(lib, "IBUF")
|
|
10
|
+
i = snl.SNLScalarTerm.create(ibuf, snl.SNLTerm.Direction.Input, "I")
|
|
11
|
+
o = snl.SNLScalarTerm.create(ibuf, snl.SNLTerm.Direction.Output, "O")
|
|
12
|
+
ibuf.addCombinatorialArcs(i, o)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def constructOBUF(lib):
|
|
16
|
+
obuf = snl.SNLDesign.createPrimitive(lib, "OBUF")
|
|
17
|
+
i = snl.SNLScalarTerm.create(obuf, snl.SNLTerm.Direction.Input, "I")
|
|
18
|
+
o = snl.SNLScalarTerm.create(obuf, snl.SNLTerm.Direction.Output, "O")
|
|
19
|
+
obuf.addCombinatorialArcs(i, o)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def constructBUFG(lib):
|
|
23
|
+
bufg = snl.SNLDesign.createPrimitive(lib, "BUFG")
|
|
24
|
+
i = snl.SNLScalarTerm.create(bufg, snl.SNLTerm.Direction.Input, "I")
|
|
25
|
+
o = snl.SNLScalarTerm.create(bufg, snl.SNLTerm.Direction.Output, "O")
|
|
26
|
+
bufg.addCombinatorialArcs(i, o)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def constructDSP48E1(lib):
|
|
30
|
+
dsp48e1 = snl.SNLDesign.createPrimitive(lib, "DSP48E1")
|
|
31
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Output, 29, 0, "ACOUT")
|
|
32
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Output, 17, 0, "BCOUT")
|
|
33
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Output, "CARRYCASCOUT")
|
|
34
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "MULTSIGNOUT")
|
|
35
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 47, 0, "PCOUT")
|
|
36
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Output, "OVERFLOW")
|
|
37
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Output, "PATTERNBDETECT")
|
|
38
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Output, "PATTERNDETECT")
|
|
39
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Output, "UNDERFLOW")
|
|
40
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Output, 3, 0, "CARRYOUT")
|
|
41
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Output, 47, 0, "P")
|
|
42
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 29, 0, "ACIN")
|
|
43
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 17, 0, "BCIN")
|
|
44
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CARRYCASCIN")
|
|
45
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "MULTSIGNIN")
|
|
46
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 47, 0, "PCIN")
|
|
47
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 3, 0, "ALUMODE")
|
|
48
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 2, 0, "CARRYINSEL")
|
|
49
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CLK")
|
|
50
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 4, 0, "INMODE")
|
|
51
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 6, 0, "OPMODE")
|
|
52
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 29, 0, "A")
|
|
53
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 17, 0, "B")
|
|
54
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 47, 0, "C")
|
|
55
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CARRYIN")
|
|
56
|
+
snl.SNLBusTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, 24, 0, "D")
|
|
57
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CEA1")
|
|
58
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CEA2")
|
|
59
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CEAD")
|
|
60
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CEALUMODE")
|
|
61
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CEB1")
|
|
62
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CEB2")
|
|
63
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CEC")
|
|
64
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CECARRYIN")
|
|
65
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CECTRL")
|
|
66
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CED")
|
|
67
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CEINMODE")
|
|
68
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CEM")
|
|
69
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "CEP")
|
|
70
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "RSTA")
|
|
71
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "RSTALLCARRYIN")
|
|
72
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "RSTALUMODE")
|
|
73
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "RSTB")
|
|
74
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "RSTC")
|
|
75
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "RSTCTRL")
|
|
76
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "RSTD")
|
|
77
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "RSTINMODE")
|
|
78
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "RSTM")
|
|
79
|
+
snl.SNLScalarTerm.create(dsp48e1, snl.SNLTerm.Direction.Input, "RSTP")
|
|
80
|
+
snl.SNLParameter.create_decimal(dsp48e1, "ACASCREG", 1)
|
|
81
|
+
snl.SNLParameter.create_decimal(dsp48e1, "ADREG", 1)
|
|
82
|
+
snl.SNLParameter.create_string(dsp48e1, "A_INPUT", "DIRECT")
|
|
83
|
+
snl.SNLParameter.create_decimal(dsp48e1, "ALUMODEREG", 1)
|
|
84
|
+
snl.SNLParameter.create_decimal(dsp48e1, "AREG", 1)
|
|
85
|
+
snl.SNLParameter.create_decimal(dsp48e1, "BCASCREG", 1)
|
|
86
|
+
snl.SNLParameter.create_string(dsp48e1, "B_INPUT", "DIRECT")
|
|
87
|
+
snl.SNLParameter.create_decimal(dsp48e1, "BREG", 1)
|
|
88
|
+
snl.SNLParameter.create_decimal(dsp48e1, "CARRYINREG", 1)
|
|
89
|
+
snl.SNLParameter.create_decimal(dsp48e1, "CARRYINSELREG", 1)
|
|
90
|
+
snl.SNLParameter.create_decimal(dsp48e1, "CREG", 1)
|
|
91
|
+
snl.SNLParameter.create_decimal(dsp48e1, "DREG", 1)
|
|
92
|
+
snl.SNLParameter.create_decimal(dsp48e1, "INMODEREG", 1)
|
|
93
|
+
snl.SNLParameter.create_decimal(dsp48e1, "MREG", 1)
|
|
94
|
+
snl.SNLParameter.create_decimal(dsp48e1, "OPMODEREG", 1)
|
|
95
|
+
snl.SNLParameter.create_decimal(dsp48e1, "PREG", 1)
|
|
96
|
+
snl.SNLParameter.create_boolean(dsp48e1, "USE_DPORT", False)
|
|
97
|
+
snl.SNLParameter.create_string(dsp48e1, "USE_MULT", "MULTIPLY")
|
|
98
|
+
snl.SNLParameter.create_string(dsp48e1, "USE_SIMD", "ONE48")
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def constructINV(lib):
|
|
102
|
+
inv = snl.SNLDesign.createPrimitive(lib, "INV")
|
|
103
|
+
i = snl.SNLScalarTerm.create(inv, snl.SNLTerm.Direction.Input, "I")
|
|
104
|
+
o = snl.SNLScalarTerm.create(inv, snl.SNLTerm.Direction.Output, "O")
|
|
105
|
+
snl.SNLDesign.addCombinatorialArcs(i, o)
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def constructCARRY4(lib):
|
|
109
|
+
carry4 = snl.SNLDesign.createPrimitive(lib, "CARRY4")
|
|
110
|
+
o = snl.SNLBusTerm.create(carry4, snl.SNLTerm.Direction.Output, 3, 0, "O")
|
|
111
|
+
co = snl.SNLBusTerm.create(carry4, snl.SNLTerm.Direction.Output, 3, 0, "CO")
|
|
112
|
+
di = snl.SNLBusTerm.create(carry4, snl.SNLTerm.Direction.Input, 3, 0, "DI")
|
|
113
|
+
s = snl.SNLBusTerm.create(carry4, snl.SNLTerm.Direction.Input, 3, 0, "S")
|
|
114
|
+
cyinit = snl.SNLScalarTerm.create(carry4, snl.SNLTerm.Direction.Input, "CYINIT")
|
|
115
|
+
ci = snl.SNLScalarTerm.create(carry4, snl.SNLTerm.Direction.Input, "CI")
|
|
116
|
+
o_bits = [b for b in o.getBits()]
|
|
117
|
+
co_bits = [b for b in co.getBits()]
|
|
118
|
+
di_bits = [b for b in di.getBits()]
|
|
119
|
+
s_bits = [b for b in s.getBits()]
|
|
120
|
+
# cyinit and ci are in combinatorial dependency with o and co outputs
|
|
121
|
+
snl.SNLDesign.addCombinatorialArcs([cyinit, ci], [o, co])
|
|
122
|
+
snl.SNLDesign.addCombinatorialArcs(s_bits[0], [o, co])
|
|
123
|
+
snl.SNLDesign.addCombinatorialArcs(s_bits[1], [o_bits[1], o_bits[2], o_bits[3]])
|
|
124
|
+
snl.SNLDesign.addCombinatorialArcs(s_bits[1], [co_bits[1], co_bits[2], co_bits[3]])
|
|
125
|
+
snl.SNLDesign.addCombinatorialArcs(s_bits[2], [o_bits[2], o_bits[3]])
|
|
126
|
+
snl.SNLDesign.addCombinatorialArcs(s_bits[2], [co_bits[2], co_bits[3]])
|
|
127
|
+
snl.SNLDesign.addCombinatorialArcs(s_bits[3], o_bits[3])
|
|
128
|
+
snl.SNLDesign.addCombinatorialArcs(s_bits[3], co_bits[3])
|
|
129
|
+
snl.SNLDesign.addCombinatorialArcs(di_bits[0], [o_bits[1], o_bits[2], o_bits[3]])
|
|
130
|
+
snl.SNLDesign.addCombinatorialArcs(di_bits[0], co)
|
|
131
|
+
snl.SNLDesign.addCombinatorialArcs(di_bits[1], [o_bits[2], o_bits[3]])
|
|
132
|
+
snl.SNLDesign.addCombinatorialArcs(di_bits[1], [co_bits[1], co_bits[2], co_bits[3]])
|
|
133
|
+
snl.SNLDesign.addCombinatorialArcs(di_bits[2], o_bits[3])
|
|
134
|
+
snl.SNLDesign.addCombinatorialArcs(di_bits[2], [co_bits[2], co_bits[3]])
|
|
135
|
+
snl.SNLDesign.addCombinatorialArcs(di_bits[3], co_bits[3])
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
def constructLUT1(lib):
|
|
139
|
+
lut1 = snl.SNLDesign.createPrimitive(lib, "LUT1")
|
|
140
|
+
i0 = snl.SNLScalarTerm.create(lut1, snl.SNLTerm.Direction.Input, "I0")
|
|
141
|
+
o = snl.SNLScalarTerm.create(lut1, snl.SNLTerm.Direction.Output, "O")
|
|
142
|
+
snl.SNLDesign.addCombinatorialArcs(i0, o)
|
|
143
|
+
snl.SNLParameter.create_binary(lut1, "INIT", 2, 0b00)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
def constructLUT2(lib):
|
|
147
|
+
lut2 = snl.SNLDesign.createPrimitive(lib, "LUT2")
|
|
148
|
+
i0 = snl.SNLScalarTerm.create(lut2, snl.SNLTerm.Direction.Input, "I0")
|
|
149
|
+
i1 = snl.SNLScalarTerm.create(lut2, snl.SNLTerm.Direction.Input, "I1")
|
|
150
|
+
o = snl.SNLScalarTerm.create(lut2, snl.SNLTerm.Direction.Output, "O")
|
|
151
|
+
snl.SNLDesign.addCombinatorialArcs([i0, i1], o)
|
|
152
|
+
snl.SNLParameter.create_binary(lut2, "INIT", 4, 0x0)
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def constructLUT3(lib):
|
|
156
|
+
lut3 = snl.SNLDesign.createPrimitive(lib, "LUT3")
|
|
157
|
+
i0 = snl.SNLScalarTerm.create(lut3, snl.SNLTerm.Direction.Input, "I0")
|
|
158
|
+
i1 = snl.SNLScalarTerm.create(lut3, snl.SNLTerm.Direction.Input, "I1")
|
|
159
|
+
i2 = snl.SNLScalarTerm.create(lut3, snl.SNLTerm.Direction.Input, "I2")
|
|
160
|
+
o = snl.SNLScalarTerm.create(lut3, snl.SNLTerm.Direction.Output, "O")
|
|
161
|
+
snl.SNLDesign.addCombinatorialArcs([i0, i1, i2], o)
|
|
162
|
+
snl.SNLParameter.create_binary(lut3, "INIT", 8, 0x00)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
def constructLUT4(lib):
|
|
166
|
+
lut4 = snl.SNLDesign.createPrimitive(lib, "LUT4")
|
|
167
|
+
i0 = snl.SNLScalarTerm.create(lut4, snl.SNLTerm.Direction.Input, "I0")
|
|
168
|
+
i1 = snl.SNLScalarTerm.create(lut4, snl.SNLTerm.Direction.Input, "I1")
|
|
169
|
+
i2 = snl.SNLScalarTerm.create(lut4, snl.SNLTerm.Direction.Input, "I2")
|
|
170
|
+
i3 = snl.SNLScalarTerm.create(lut4, snl.SNLTerm.Direction.Input, "I3")
|
|
171
|
+
o = snl.SNLScalarTerm.create(lut4, snl.SNLTerm.Direction.Output, "O")
|
|
172
|
+
snl.SNLDesign.addCombinatorialArcs([i0, i1, i2, i3], o)
|
|
173
|
+
snl.SNLParameter.create_binary(lut4, "INIT", 16, 0x0000)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
def constructLUT5(lib):
|
|
177
|
+
lut5 = snl.SNLDesign.createPrimitive(lib, "LUT5")
|
|
178
|
+
i0 = snl.SNLScalarTerm.create(lut5, snl.SNLTerm.Direction.Input, "I0")
|
|
179
|
+
i1 = snl.SNLScalarTerm.create(lut5, snl.SNLTerm.Direction.Input, "I1")
|
|
180
|
+
i2 = snl.SNLScalarTerm.create(lut5, snl.SNLTerm.Direction.Input, "I2")
|
|
181
|
+
i3 = snl.SNLScalarTerm.create(lut5, snl.SNLTerm.Direction.Input, "I3")
|
|
182
|
+
i4 = snl.SNLScalarTerm.create(lut5, snl.SNLTerm.Direction.Input, "I4")
|
|
183
|
+
o = snl.SNLScalarTerm.create(lut5, snl.SNLTerm.Direction.Output, "O")
|
|
184
|
+
snl.SNLDesign.addCombinatorialArcs([i0, i1, i2, i3, i4], o)
|
|
185
|
+
snl.SNLParameter.create_binary(lut5, "INIT", 32, 0x00000000)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def constructLUT6(lib):
|
|
189
|
+
lut6 = snl.SNLDesign.createPrimitive(lib, "LUT6")
|
|
190
|
+
i0 = snl.SNLScalarTerm.create(lut6, snl.SNLTerm.Direction.Input, "I0")
|
|
191
|
+
i1 = snl.SNLScalarTerm.create(lut6, snl.SNLTerm.Direction.Input, "I1")
|
|
192
|
+
i2 = snl.SNLScalarTerm.create(lut6, snl.SNLTerm.Direction.Input, "I2")
|
|
193
|
+
i3 = snl.SNLScalarTerm.create(lut6, snl.SNLTerm.Direction.Input, "I3")
|
|
194
|
+
i4 = snl.SNLScalarTerm.create(lut6, snl.SNLTerm.Direction.Input, "I4")
|
|
195
|
+
i5 = snl.SNLScalarTerm.create(lut6, snl.SNLTerm.Direction.Input, "I5")
|
|
196
|
+
o = snl.SNLScalarTerm.create(lut6, snl.SNLTerm.Direction.Output, "O")
|
|
197
|
+
snl.SNLDesign.addCombinatorialArcs([i0, i1, i2, i3, i4, i5], o)
|
|
198
|
+
snl.SNLParameter.create_binary(lut6, "INIT", 64, 0x0000000000000000)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
def constructMUXF7(lib):
|
|
202
|
+
muxf7 = snl.SNLDesign.createPrimitive(lib, "MUXF7")
|
|
203
|
+
i0 = snl.SNLScalarTerm.create(muxf7, snl.SNLTerm.Direction.Input, "I0")
|
|
204
|
+
i1 = snl.SNLScalarTerm.create(muxf7, snl.SNLTerm.Direction.Input, "I1")
|
|
205
|
+
o = snl.SNLScalarTerm.create(muxf7, snl.SNLTerm.Direction.Output, "O")
|
|
206
|
+
s = snl.SNLScalarTerm.create(muxf7, snl.SNLTerm.Direction.Input, "S")
|
|
207
|
+
snl.SNLDesign.addCombinatorialArcs([i0, i1, s], o)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
def constructMUXF8(lib):
|
|
211
|
+
muxf8 = snl.SNLDesign.createPrimitive(lib, "MUXF8")
|
|
212
|
+
i0 = snl.SNLScalarTerm.create(muxf8, snl.SNLTerm.Direction.Input, "I0")
|
|
213
|
+
i1 = snl.SNLScalarTerm.create(muxf8, snl.SNLTerm.Direction.Input, "I1")
|
|
214
|
+
o = snl.SNLScalarTerm.create(muxf8, snl.SNLTerm.Direction.Output, "O")
|
|
215
|
+
s = snl.SNLScalarTerm.create(muxf8, snl.SNLTerm.Direction.Input, "S")
|
|
216
|
+
snl.SNLDesign.addCombinatorialArcs([i0, i1, s], o)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def constructSRL16E(lib):
|
|
220
|
+
srl16e = snl.SNLDesign.createPrimitive(lib, "SRL16E")
|
|
221
|
+
snl.SNLScalarTerm.create(srl16e, snl.SNLTerm.Direction.Input, "CE")
|
|
222
|
+
snl.SNLScalarTerm.create(srl16e, snl.SNLTerm.Direction.Input, "CLK")
|
|
223
|
+
snl.SNLScalarTerm.create(srl16e, snl.SNLTerm.Direction.Input, "D")
|
|
224
|
+
snl.SNLScalarTerm.create(srl16e, snl.SNLTerm.Direction.Output, "Q")
|
|
225
|
+
snl.SNLScalarTerm.create(srl16e, snl.SNLTerm.Direction.Input, "A0")
|
|
226
|
+
snl.SNLScalarTerm.create(srl16e, snl.SNLTerm.Direction.Input, "A1")
|
|
227
|
+
snl.SNLScalarTerm.create(srl16e, snl.SNLTerm.Direction.Input, "A2")
|
|
228
|
+
snl.SNLScalarTerm.create(srl16e, snl.SNLTerm.Direction.Input, "A3")
|
|
229
|
+
snl.SNLParameter.create_binary(srl16e, "INIT", 16, 0x0000)
|
|
230
|
+
snl.SNLParameter.create_binary(srl16e, "IS_CLK_INVERTED", 1, 0)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def constructFDCE(lib):
|
|
234
|
+
fdce = snl.SNLDesign.createPrimitive(lib, "FDCE")
|
|
235
|
+
q = snl.SNLScalarTerm.create(fdce, snl.SNLTerm.Direction.Output, "Q")
|
|
236
|
+
c = snl.SNLScalarTerm.create(fdce, snl.SNLTerm.Direction.Input, "C")
|
|
237
|
+
ce = snl.SNLScalarTerm.create(fdce, snl.SNLTerm.Direction.Input, "CE")
|
|
238
|
+
clr = snl.SNLScalarTerm.create(fdce, snl.SNLTerm.Direction.Input, "CLR")
|
|
239
|
+
d = snl.SNLScalarTerm.create(fdce, snl.SNLTerm.Direction.Input, "D")
|
|
240
|
+
snl.SNLParameter.create_binary(fdce, "INIT", 1, 0b0)
|
|
241
|
+
snl.SNLDesign.addInputsToClockArcs([ce, clr, d], c)
|
|
242
|
+
snl.SNLDesign.addClockToOutputsArcs(c, q)
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
def constructFDPE(lib):
|
|
246
|
+
fdpe = snl.SNLDesign.createPrimitive(lib, "FDPE")
|
|
247
|
+
q = snl.SNLScalarTerm.create(fdpe, snl.SNLTerm.Direction.Output, "Q")
|
|
248
|
+
c = snl.SNLScalarTerm.create(fdpe, snl.SNLTerm.Direction.Input, "C")
|
|
249
|
+
ce = snl.SNLScalarTerm.create(fdpe, snl.SNLTerm.Direction.Input, "CE")
|
|
250
|
+
pre = snl.SNLScalarTerm.create(fdpe, snl.SNLTerm.Direction.Input, "PRE")
|
|
251
|
+
d = snl.SNLScalarTerm.create(fdpe, snl.SNLTerm.Direction.Input, "D")
|
|
252
|
+
snl.SNLParameter.create_binary(fdpe, "INIT", 1, 0b1)
|
|
253
|
+
snl.SNLDesign.addInputsToClockArcs([ce, pre, d], c)
|
|
254
|
+
snl.SNLDesign.addClockToOutputsArcs(c, q)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
def constructFDRE(lib):
|
|
258
|
+
fdre = snl.SNLDesign.createPrimitive(lib, "FDRE")
|
|
259
|
+
q = snl.SNLScalarTerm.create(fdre, snl.SNLTerm.Direction.Output, "Q")
|
|
260
|
+
c = snl.SNLScalarTerm.create(fdre, snl.SNLTerm.Direction.Input, "C")
|
|
261
|
+
ce = snl.SNLScalarTerm.create(fdre, snl.SNLTerm.Direction.Input, "CE")
|
|
262
|
+
r = snl.SNLScalarTerm.create(fdre, snl.SNLTerm.Direction.Input, "R")
|
|
263
|
+
d = snl.SNLScalarTerm.create(fdre, snl.SNLTerm.Direction.Input, "D")
|
|
264
|
+
snl.SNLParameter.create_binary(fdre, "INIT", 1, 0b0)
|
|
265
|
+
snl.SNLDesign.addInputsToClockArcs([ce, r, d], c)
|
|
266
|
+
snl.SNLDesign.addClockToOutputsArcs(c, q)
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
def constructFDSE(lib):
|
|
270
|
+
fdse = snl.SNLDesign.createPrimitive(lib, "FDSE")
|
|
271
|
+
q = snl.SNLScalarTerm.create(fdse, snl.SNLTerm.Direction.Output, "Q")
|
|
272
|
+
c = snl.SNLScalarTerm.create(fdse, snl.SNLTerm.Direction.Input, "C")
|
|
273
|
+
ce = snl.SNLScalarTerm.create(fdse, snl.SNLTerm.Direction.Input, "CE")
|
|
274
|
+
s = snl.SNLScalarTerm.create(fdse, snl.SNLTerm.Direction.Input, "S")
|
|
275
|
+
d = snl.SNLScalarTerm.create(fdse, snl.SNLTerm.Direction.Input, "D")
|
|
276
|
+
snl.SNLParameter.create_binary(fdse, "INIT", 1, 0b0)
|
|
277
|
+
snl.SNLDesign.addInputsToClockArcs([ce, s, d], c)
|
|
278
|
+
snl.SNLDesign.addClockToOutputsArcs(c, q)
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
def constructRAM32M(lib):
|
|
282
|
+
ram32m = snl.SNLDesign.createPrimitive(lib, "RAM32M")
|
|
283
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Output, 1, 0, "DOA")
|
|
284
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Output, 1, 0, "DOB")
|
|
285
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Output, 1, 0, "DOC")
|
|
286
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Output, 1, 0, "DOD")
|
|
287
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Input, 4, 0, "ADDRA")
|
|
288
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Input, 4, 0, "ADDRB")
|
|
289
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Input, 4, 0, "ADDRC")
|
|
290
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Input, 4, 0, "ADDRD")
|
|
291
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Input, 1, 0, "DIA")
|
|
292
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Input, 1, 0, "DIB")
|
|
293
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Input, 1, 0, "DIC")
|
|
294
|
+
snl.SNLBusTerm.create(ram32m, snl.SNLTerm.Direction.Input, 1, 0, "DID")
|
|
295
|
+
snl.SNLScalarTerm.create(ram32m, snl.SNLTerm.Direction.Input, "WCLK")
|
|
296
|
+
snl.SNLScalarTerm.create(ram32m, snl.SNLTerm.Direction.Input, "WE")
|
|
297
|
+
snl.SNLParameter.create_binary(ram32m, "INIT_A", 64, 0)
|
|
298
|
+
snl.SNLParameter.create_binary(ram32m, "INIT_B", 64, 0)
|
|
299
|
+
snl.SNLParameter.create_binary(ram32m, "INIT_C", 64, 0)
|
|
300
|
+
snl.SNLParameter.create_binary(ram32m, "INIT_D", 64, 0)
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
def constructRAM64M(lib):
|
|
304
|
+
ram64m = snl.SNLDesign.createPrimitive(lib, "RAM64M")
|
|
305
|
+
snl.SNLScalarTerm.create(ram64m, snl.SNLTerm.Direction.Output, "DOA")
|
|
306
|
+
snl.SNLScalarTerm.create(ram64m, snl.SNLTerm.Direction.Output, "DOB")
|
|
307
|
+
snl.SNLScalarTerm.create(ram64m, snl.SNLTerm.Direction.Output, "DOC")
|
|
308
|
+
snl.SNLScalarTerm.create(ram64m, snl.SNLTerm.Direction.Output, "DOD")
|
|
309
|
+
snl.SNLBusTerm.create(ram64m, snl.SNLTerm.Direction.Input, 5, 0, "ADDRA")
|
|
310
|
+
snl.SNLBusTerm.create(ram64m, snl.SNLTerm.Direction.Input, 5, 0, "ADDRB")
|
|
311
|
+
snl.SNLBusTerm.create(ram64m, snl.SNLTerm.Direction.Input, 5, 0, "ADDRC")
|
|
312
|
+
snl.SNLBusTerm.create(ram64m, snl.SNLTerm.Direction.Input, 5, 0, "ADDRD")
|
|
313
|
+
snl.SNLScalarTerm.create(ram64m, snl.SNLTerm.Direction.Input, "DIA")
|
|
314
|
+
snl.SNLScalarTerm.create(ram64m, snl.SNLTerm.Direction.Input, "DIB")
|
|
315
|
+
snl.SNLScalarTerm.create(ram64m, snl.SNLTerm.Direction.Input, "DIC")
|
|
316
|
+
snl.SNLScalarTerm.create(ram64m, snl.SNLTerm.Direction.Input, "DID")
|
|
317
|
+
snl.SNLScalarTerm.create(ram64m, snl.SNLTerm.Direction.Input, "WCLK")
|
|
318
|
+
snl.SNLScalarTerm.create(ram64m, snl.SNLTerm.Direction.Input, "WE")
|
|
319
|
+
snl.SNLParameter.create_binary(ram64m, "INIT_A", 64, 0)
|
|
320
|
+
snl.SNLParameter.create_binary(ram64m, "INIT_B", 64, 0)
|
|
321
|
+
snl.SNLParameter.create_binary(ram64m, "INIT_C", 64, 0)
|
|
322
|
+
snl.SNLParameter.create_binary(ram64m, "INIT_D", 64, 0)
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
def constructRAMB18E1(lib):
|
|
326
|
+
ramb18e1 = snl.SNLDesign.createPrimitive(lib, "RAMB18E1")
|
|
327
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, 13, 0, "ADDRARDADDR")
|
|
328
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, 13, 0, "ADDRBWRADDR")
|
|
329
|
+
snl.SNLScalarTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, "CLKARDCLK")
|
|
330
|
+
snl.SNLScalarTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, "CLKBWRCLK")
|
|
331
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, 15, 0, "DIADI")
|
|
332
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, 15, 0, "DIBDI")
|
|
333
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, 1, 0, "DIPADIP")
|
|
334
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, 1, 0, "DIPBDIP")
|
|
335
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Output, 15, 0, "DOADO")
|
|
336
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Output, 15, 0, "DOBDO")
|
|
337
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Output, 1, 0, "DOPADOP")
|
|
338
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Output, 1, 0, "DOPBDOP")
|
|
339
|
+
snl.SNLScalarTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, "ENARDEN")
|
|
340
|
+
snl.SNLScalarTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, "ENBWREN")
|
|
341
|
+
snl.SNLScalarTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, "REGCEAREGCE")
|
|
342
|
+
snl.SNLScalarTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, "REGCEB")
|
|
343
|
+
snl.SNLScalarTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, "RSTRAMARSTRAM")
|
|
344
|
+
snl.SNLScalarTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, "RSTRAMB")
|
|
345
|
+
snl.SNLScalarTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, "RSTREGARSTREG")
|
|
346
|
+
snl.SNLScalarTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, "RSTREGB")
|
|
347
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, 1, 0, "WEA")
|
|
348
|
+
snl.SNLBusTerm.create(ramb18e1, snl.SNLTerm.Direction.Input, 3, 0, "WEBWE")
|
|
349
|
+
snl.SNLParameter.create_decimal(ramb18e1, "DOA_REG", 0)
|
|
350
|
+
snl.SNLParameter.create_decimal(ramb18e1, "DOB_REG", 0)
|
|
351
|
+
snl.SNLParameter.create_binary(ramb18e1, "INIT_A", 18, 0x00000)
|
|
352
|
+
snl.SNLParameter.create_binary(ramb18e1, "INIT_B", 18, 0x00000)
|
|
353
|
+
for i in range(64):
|
|
354
|
+
paramName = "INIT_" + hex(i)[2:].zfill(2).upper()
|
|
355
|
+
snl.SNLParameter.create_binary(ramb18e1, paramName, 256, 0)
|
|
356
|
+
for i in range(8):
|
|
357
|
+
paramName = "INITP_" + hex(i)[2:].zfill(2).upper()
|
|
358
|
+
snl.SNLParameter.create_binary(ramb18e1, paramName, 256, 0)
|
|
359
|
+
snl.SNLParameter.create_string(ramb18e1, "RAM_MODE", "TDP")
|
|
360
|
+
snl.SNLParameter.create_decimal(ramb18e1, "READ_WIDTH_A", 0)
|
|
361
|
+
snl.SNLParameter.create_decimal(ramb18e1, "READ_WIDTH_B", 0)
|
|
362
|
+
snl.SNLParameter.create_binary(ramb18e1, "SRVAL_A", 18, 0)
|
|
363
|
+
snl.SNLParameter.create_binary(ramb18e1, "SRVAL_B", 18, 0)
|
|
364
|
+
snl.SNLParameter.create_string(ramb18e1, "WRITE_MODE_A", "WRITE_FIRST")
|
|
365
|
+
snl.SNLParameter.create_string(ramb18e1, "WRITE_MODE_B", "WRITE_FIRST")
|
|
366
|
+
snl.SNLParameter.create_decimal(ramb18e1, "WRITE_WIDTH_A", 0)
|
|
367
|
+
snl.SNLParameter.create_decimal(ramb18e1, "WRITE_WIDTH_B", 0)
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
def constructRAMB36E1(lib):
|
|
371
|
+
ramb36e1 = snl.SNLDesign.createPrimitive(lib, "RAMB36E1")
|
|
372
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, 15, 0, "ADDRARDADDR")
|
|
373
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, 15, 0, "ADDRBWRADDR")
|
|
374
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "CASCADEINA")
|
|
375
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "CASCADEINB")
|
|
376
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Output, "CASCADEOUTA")
|
|
377
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Output, "CASCADEOUTB")
|
|
378
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "CLKARDCLK")
|
|
379
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "CLKBWRCLK")
|
|
380
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Output, "DBITERR")
|
|
381
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, 31, 0, "DIADI")
|
|
382
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, 31, 0, "DIBDI")
|
|
383
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, 3, 0, "DIPADIP")
|
|
384
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, 3, 0, "DIPBDIP")
|
|
385
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Output, 31, 0, "DOADO")
|
|
386
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Output, 31, 0, "DOBDO")
|
|
387
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Output, 3, 0, "DOPADOP")
|
|
388
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Output, 3, 0, "DOPBDOP")
|
|
389
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Output, 7, 0, "ECCPARITY")
|
|
390
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "ENARDEN")
|
|
391
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "ENBWREN")
|
|
392
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "INJECTDBITERR")
|
|
393
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "INJECTSBITERR")
|
|
394
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Output, 8, 0, "RDADDRECC")
|
|
395
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "REGCEAREGCE")
|
|
396
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "REGCEB")
|
|
397
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "RSTRAMARSTRAM")
|
|
398
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "RSTRAMB")
|
|
399
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "RSTREGARSTREG")
|
|
400
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, "RSTREGB")
|
|
401
|
+
snl.SNLScalarTerm.create(ramb36e1, snl.SNLTerm.Direction.Output, "SBITERR")
|
|
402
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, 3, 0, "WEA")
|
|
403
|
+
snl.SNLBusTerm.create(ramb36e1, snl.SNLTerm.Direction.Input, 7, 0, "WEBWE")
|
|
404
|
+
|
|
405
|
+
snl.SNLParameter.create_decimal(ramb36e1, "DOA_REG", 0)
|
|
406
|
+
snl.SNLParameter.create_decimal(ramb36e1, "DOB_REG", 0)
|
|
407
|
+
snl.SNLParameter.create_binary(ramb36e1, "INIT_A", 36, 0)
|
|
408
|
+
snl.SNLParameter.create_binary(ramb36e1, "INIT_B", 36, 0)
|
|
409
|
+
for i in range(128):
|
|
410
|
+
paramName = "INIT_" + hex(i)[2:].zfill(2).upper()
|
|
411
|
+
snl.SNLParameter.create_binary(ramb36e1, paramName, 256, 0)
|
|
412
|
+
snl.SNLParameter.create_string(ramb36e1, "RAM_EXTENSION_A", "NONE")
|
|
413
|
+
snl.SNLParameter.create_string(ramb36e1, "RAM_EXTENSION_B", "NONE")
|
|
414
|
+
for i in range(16):
|
|
415
|
+
paramName = "INITP_" + hex(i)[2:].zfill(2).upper()
|
|
416
|
+
snl.SNLParameter.create_binary(ramb36e1, paramName, 256, 0)
|
|
417
|
+
snl.SNLParameter.create_string(ramb36e1, "RAM_MODE", "TDP")
|
|
418
|
+
snl.SNLParameter.create_decimal(ramb36e1, "READ_WIDTH_A", 0)
|
|
419
|
+
snl.SNLParameter.create_decimal(ramb36e1, "READ_WIDTH_B", 0)
|
|
420
|
+
snl.SNLParameter.create_decimal(ramb36e1, "WRITE_WIDTH_A", 0)
|
|
421
|
+
snl.SNLParameter.create_decimal(ramb36e1, "WRITE_WIDTH_B", 0)
|
|
422
|
+
snl.SNLParameter.create_binary(ramb36e1, "SRVAL_A", 36, 0)
|
|
423
|
+
snl.SNLParameter.create_binary(ramb36e1, "SRVAL_B", 36, 0)
|
|
424
|
+
snl.SNLParameter.create_string(ramb36e1, "WRITE_MODE_A", "WRITE_FIRST")
|
|
425
|
+
snl.SNLParameter.create_string(ramb36e1, "WRITE_MODE_B", "WRITE_FIRST")
|
|
426
|
+
|
|
427
|
+
|
|
428
|
+
def load(db):
|
|
429
|
+
lib = snl.SNLLibrary.createPrimitives(db, "xilinx")
|
|
430
|
+
constructIBUF(lib)
|
|
431
|
+
constructOBUF(lib)
|
|
432
|
+
constructBUFG(lib)
|
|
433
|
+
constructDSP48E1(lib)
|
|
434
|
+
constructINV(lib)
|
|
435
|
+
constructCARRY4(lib)
|
|
436
|
+
constructLUT1(lib)
|
|
437
|
+
constructLUT2(lib)
|
|
438
|
+
constructLUT3(lib)
|
|
439
|
+
constructLUT4(lib)
|
|
440
|
+
constructLUT5(lib)
|
|
441
|
+
constructLUT6(lib)
|
|
442
|
+
constructMUXF7(lib)
|
|
443
|
+
constructMUXF8(lib)
|
|
444
|
+
constructSRL16E(lib)
|
|
445
|
+
constructFDCE(lib)
|
|
446
|
+
constructFDPE(lib)
|
|
447
|
+
constructFDRE(lib)
|
|
448
|
+
constructFDSE(lib)
|
|
449
|
+
constructRAM32M(lib)
|
|
450
|
+
constructRAM64M(lib)
|
|
451
|
+
constructRAMB18E1(lib)
|
|
452
|
+
constructRAMB36E1(lib)
|
najaeda/snl.so
CHANGED
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: najaeda
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.5
|
|
4
4
|
Summary: Naja EDA Python package
|
|
5
5
|
Author-Email: Naja Authors <contact@keplertech.io>
|
|
6
6
|
License: Apache License 2.0
|
|
@@ -33,10 +33,6 @@ a netlist from a Verilog file.
|
|
|
33
33
|
|
|
34
34
|
.. code-block:: python
|
|
35
35
|
|
|
36
|
-
from os import path
|
|
37
|
-
import sys
|
|
38
|
-
from najaeda import netlist
|
|
39
|
-
|
|
40
36
|
benchmarks = path.join('..','benchmarks')
|
|
41
37
|
liberty_files = [
|
|
42
38
|
'NangateOpenCellLibrary_typical.lib',
|
|
@@ -50,9 +46,25 @@ a netlist from a Verilog file.
|
|
|
50
46
|
|
|
51
47
|
top.dump_verilog('.', 'tinyrocket_naja.v')
|
|
52
48
|
|
|
49
|
+
Load a design with pre-existing libraries
|
|
50
|
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
51
|
+
In FPGA design environments, Liberty files are often unavailable.
|
|
52
|
+
To address this, the following example demonstrates how to load primitives
|
|
53
|
+
without relying on Liberty files.
|
|
54
|
+
|
|
55
|
+
najaeda comes with pre-configured libraries to simplify this process.
|
|
56
|
+
Currently, it includes support for partial Xilinx primitives, but this can be
|
|
57
|
+
easily extended in the future. Don't hesitate to reach out if you need help.
|
|
58
|
+
|
|
59
|
+
.. code-block:: python
|
|
60
|
+
|
|
61
|
+
netlist.load_primitives('xilinx')
|
|
62
|
+
benchmarks = path.join('..','benchmarks')
|
|
63
|
+
top = netlist.load_verilog([path.join(benchmarks, 'verilog', 'arm_core_netlist.v')])
|
|
64
|
+
|
|
53
65
|
Print all the instances in the netlist
|
|
54
66
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
55
|
-
Next example shows how to browse all the netlist and print all its content.
|
|
67
|
+
Next example shows how to browse all the netlist and print all its content recursively.
|
|
56
68
|
|
|
57
69
|
.. code-block:: python
|
|
58
70
|
|
|
@@ -61,12 +73,30 @@ Next example shows how to browse all the netlist and print all its content.
|
|
|
61
73
|
print(f"{child_instance}:{child_instance.get_model_name()}")
|
|
62
74
|
print_netlist(child_instance)
|
|
63
75
|
|
|
76
|
+
Similar to the previous example, but utilizing an instance visitor.
|
|
77
|
+
This approach allows you to perform operations on each instance while
|
|
78
|
+
also defining conditions for stopping or continuing exploration.
|
|
79
|
+
|
|
80
|
+
.. code-block:: python
|
|
81
|
+
|
|
82
|
+
def print_instance(instance):
|
|
83
|
+
print(f"{instance}:{instance.get_model_name()}")
|
|
84
|
+
visitor_config = instance_visitor.VisitorConfig(callback=print_instance)
|
|
85
|
+
instance_visitor.Visitor(top).visit(top, visitor_config)
|
|
86
|
+
|
|
64
87
|
Documentation
|
|
65
88
|
-------------
|
|
89
|
+
najaeda is a work in progress, and the documentation is still under development.
|
|
66
90
|
|
|
67
91
|
Naja documentation is available on the `Naja GitHub repository <https://github.com/najaeda/naja>`_.
|
|
68
92
|
|
|
69
|
-
|
|
93
|
+
Support
|
|
70
94
|
-------
|
|
95
|
+
Please put up issues on the Delocate issue tracker.
|
|
96
|
+
If you encounter any issues or have questions, please report them on the
|
|
97
|
+
`Naja issue tracker <https://github.com/najaeda/naja/issues>`_.
|
|
71
98
|
|
|
72
|
-
|
|
99
|
+
License
|
|
100
|
+
-------
|
|
101
|
+
This project is licensed under the Apache License 2.0.
|
|
102
|
+
See the `LICENSE <https://github.com/najaeda/naja/blob/main/LICENSE>`_ file for details.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
najaeda-0.1.5.dist-info/RECORD,,
|
|
2
|
+
najaeda-0.1.5.dist-info/WHEEL,sha256=WOiMFvo9bzNKIh5Rxx7xDwR4DzXJ4VAFWxSvvQdE_uA,115
|
|
3
|
+
najaeda-0.1.5.dist-info/METADATA,sha256=WuZMeLEC6yRy9aEA4UiQ5Bg9RA_NtPplvGclOEt6h7c,3511
|
|
4
|
+
najaeda-0.1.5.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
+
najaeda-0.1.5.dist-info/licenses/AUTHORS,sha256=7NYEGDAX_1QZvCCHfq8YVXC5ZbwH_pbNI8DcSmm70GU,377
|
|
6
|
+
najaeda/netlist.py,sha256=jzpnmhGdkXRmSYmMNv3YGe3KC9BB9eoQc0Y3zlMh3ag,25748
|
|
7
|
+
najaeda/libnaja_snl_python.dylib,sha256=S64GfIw9I7Lj391D9ZVwZjFAXeTB0VCbXsq5euw3zGA,740288
|
|
8
|
+
najaeda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
najaeda/libnaja_snl.dylib,sha256=8Ei7KKU0b14IqlvH_8yQSSCpH0rjbxpeRaXgyfSemMY,574112
|
|
10
|
+
najaeda/snl.so,sha256=Og454YB20jBXM9_5w2YG0e-yDHX95KaJxdGK-6FvjW4,97888
|
|
11
|
+
najaeda/instance_visitor.py,sha256=HrrOnCSuw5Lh1HSp2R-ckYP4gEbqdxp_rw3Sl0GpGHE,1479
|
|
12
|
+
najaeda/primitives/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
|
+
najaeda/primitives/xilinx.py,sha256=fuu4KxEIuC0ueCK4C_gds6hzgtJsLE3tjDtOHtY9McM,25947
|
|
@@ -3,4 +3,5 @@
|
|
|
3
3
|
# This does not necessarily list everyone who has contributed code, since in
|
|
4
4
|
# some cases, their employer may be the copyright holder. To see the full list
|
|
5
5
|
# of contributors, see the revision history in source control.
|
|
6
|
-
Christophe Alexandre <christophe.
|
|
6
|
+
Christophe Alexandre <christophe.alexandre@keplertech.io>
|
|
7
|
+
Noam Cohen <noam.cohen@keplertech.io>
|
najaeda/.dylibs/PythonT
DELETED
|
Binary file
|
najaeda-0.1.3.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
najaeda-0.1.3.dist-info/RECORD,,
|
|
2
|
-
najaeda-0.1.3.dist-info/WHEEL,sha256=WOiMFvo9bzNKIh5Rxx7xDwR4DzXJ4VAFWxSvvQdE_uA,115
|
|
3
|
-
najaeda-0.1.3.dist-info/METADATA,sha256=cUsTBMA9mhbFVF1WSI0wQYb3hc9-ThpBYShih2Yru6E,2147
|
|
4
|
-
najaeda-0.1.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
5
|
-
najaeda-0.1.3.dist-info/licenses/AUTHORS,sha256=e4DCPGHo6wKMyQz24V59EP7zMwalK-KBDBHHlMLFxHY,330
|
|
6
|
-
najaeda/netlist.py,sha256=sKIacJE8olG3-NxUru0ntAnzeU-enJNocnvJ3O0Jnp0,25102
|
|
7
|
-
najaeda/libnaja_snl_python.dylib,sha256=NufBTjIC-14Ailajr63ycpoHng0PONuZY3y26c9aehw,740272
|
|
8
|
-
najaeda/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
-
najaeda/libnaja_snl.dylib,sha256=8Ei7KKU0b14IqlvH_8yQSSCpH0rjbxpeRaXgyfSemMY,574112
|
|
10
|
-
najaeda/snl.so,sha256=Pm6IrWbo5sJ7VbokbTf36Q_tVlttrtXkNT4A_b4X1Pg,97888
|
|
11
|
-
najaeda/.dylibs/PythonT,sha256=PKxrOOyA9Wrc11wkOBZVdQachBkACXp9879F1jMycxc,13116640
|
|
File without changes
|
|
File without changes
|