vagen 0.0.1__tar.gz
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.
- vagen-0.0.1/LICENSE +21 -0
- vagen-0.0.1/PKG-INFO +137 -0
- vagen-0.0.1/README.md +122 -0
- vagen-0.0.1/pyproject.toml +20 -0
- vagen-0.0.1/setup.cfg +4 -0
- vagen-0.0.1/tests/testHiLevelMod.py +454 -0
- vagen-0.0.1/tests/testVA.py +1191 -0
- vagen-0.0.1/vagen/__init__.py +67 -0
- vagen-0.0.1/vagen/hilevelmod.py +2020 -0
- vagen-0.0.1/vagen/veriloga.py +3068 -0
- vagen-0.0.1/vagen.egg-info/PKG-INFO +137 -0
- vagen-0.0.1/vagen.egg-info/SOURCES.txt +13 -0
- vagen-0.0.1/vagen.egg-info/dependency_links.txt +1 -0
- vagen-0.0.1/vagen.egg-info/requires.txt +2 -0
- vagen-0.0.1/vagen.egg-info/top_level.txt +1 -0
vagen-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Rodrigo Pedroso Mendes
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
vagen-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: vagen
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Generates verilogA testbench for verification of analog IPs (VLSI design)
|
|
5
|
+
Author-email: Rodrigo Pedroso Mendes <roedroso@gmail.com>
|
|
6
|
+
Project-URL: Homepage, https://github.com/rpm2003rpm/vagen
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.7
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Requires-Dist: regex>=2023.6.3
|
|
14
|
+
Requires-Dist: datetime>=5.2
|
|
15
|
+
|
|
16
|
+
# vagen
|
|
17
|
+
|
|
18
|
+
## What is vagen?
|
|
19
|
+
|
|
20
|
+
vagen was created mainly to generate verilogA stimulus for verification of complex analog IPs. However, it has wrappers for most of the verilogA reserved words, so it also generates verilogA models.
|
|
21
|
+
|
|
22
|
+
## Instalation
|
|
23
|
+
|
|
24
|
+
You can install vagen by typing the command:
|
|
25
|
+
|
|
26
|
+
```
|
|
27
|
+
pip3 install vagen
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Example 1: Stimulus for verification of a DCDC
|
|
31
|
+
|
|
32
|
+
Let's assume that a stimulus with the following sequence is required:
|
|
33
|
+
|
|
34
|
+
* VDD must rise from 0 to 5.0V in 10us.
|
|
35
|
+
* After 10us, the clock signal (CLK) must start with a frequency of 4MHz. CLK domain is VDD.
|
|
36
|
+
* After 1us, RST must rise. RST domain is VDD.
|
|
37
|
+
* Wait for the positive edge of the signal READY when it crosses half of the domain voltage. READY domain is VDD.
|
|
38
|
+
* A current of 100mA must be drawn from the in OUT with a rise time of 100ns.
|
|
39
|
+
* After 10us, the bus CONFIG_VOUT[3:0] must be changed from 0 to 5. CONFIG_VOUT[3:0] domain is VDD.
|
|
40
|
+
* After 20us, finishes the simulation.
|
|
41
|
+
|
|
42
|
+
The python code that generates this stimulus is shown below:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
import vagen as va
|
|
46
|
+
|
|
47
|
+
#Create a module
|
|
48
|
+
mod = va.HiLevelMod("DCDC_STML")
|
|
49
|
+
|
|
50
|
+
#Create pins
|
|
51
|
+
VDD = mod.vdc(name = "VDD", width = 1, direction = "inout")
|
|
52
|
+
OUT = mod.idc(name = "OUT", width = 1, direction = "inout")
|
|
53
|
+
CLK = mod.clock(mod.dig(name = "CLK", domain = VDD, width = 1, direction = "output", rise = 100e-15, fall = 100e-15))
|
|
54
|
+
RST = mod.dig(name = "RST", domain = VDD, width = 1, value = 0, direction = "output", rise = 100e-15, fall = 100e-15)
|
|
55
|
+
READY = mod.dig(name = "READY", domain = VDD, width = 1, direction = "input")
|
|
56
|
+
CONFIG_VOUT = mod.dig(name = "CONFIG_VOUT", domain = VDD, width = 4, value = 0, direction = "output", rise = 100e-15, fall = 100e-15)
|
|
57
|
+
|
|
58
|
+
#READY positive event
|
|
59
|
+
EVNT_READY = va.Cross(READY.diffHalfDomain, "rising")
|
|
60
|
+
|
|
61
|
+
#Sequence
|
|
62
|
+
mod.seq(True)(
|
|
63
|
+
VDD.setRiseFall(10e-6, 10e-6),
|
|
64
|
+
VDD.applyV(5.0),
|
|
65
|
+
va.WaitUs(10),
|
|
66
|
+
CLK.on(4e6),
|
|
67
|
+
va.WaitUs(1),
|
|
68
|
+
RST.write(True),
|
|
69
|
+
va.WaitSignal(EVNT_READY),
|
|
70
|
+
OUT.setRiseFall(100e-9, 100e-9),
|
|
71
|
+
OUT.applyI(100e-3), #Positive current enters the model
|
|
72
|
+
va.WaitUs(10),
|
|
73
|
+
CONFIG_VOUT.write(5),
|
|
74
|
+
va.WaitUs(20),
|
|
75
|
+
va.Finish()
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
#Save veriloga file
|
|
79
|
+
file = open('veriloga.va', 'w')
|
|
80
|
+
file.write(mod.getVA())
|
|
81
|
+
file.close()
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Example 2: More than one sequence in the same veriloga
|
|
85
|
+
|
|
86
|
+
You can create a veriloga parameter called testSeq
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
seqPar = mod.par(name = "testSeq", value = 0)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
And then use this parameter to select the sequence depending on the value
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
#sequence 1
|
|
96
|
+
mod.seq(seqPar == 1)(
|
|
97
|
+
...
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
#sequence 2
|
|
101
|
+
mod.seq(seqPar == 2)(
|
|
102
|
+
...
|
|
103
|
+
)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Example 3: Model of a configurable resistor
|
|
107
|
+
|
|
108
|
+
As mentioned before, vagen can be used to generate models. As an example, the code below generates a veriloga model of a configurable resistor.
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
import vagen as va
|
|
112
|
+
|
|
113
|
+
#Create a module
|
|
114
|
+
mod = va.HiLevelMod("CONFIG_RES")
|
|
115
|
+
|
|
116
|
+
#Create pins
|
|
117
|
+
VDD = mod.electrical(name = "VDD", width = 1, direction = "inout")
|
|
118
|
+
IN1 = mod.electrical(name = "IN1", width = 1, direction = "inout")
|
|
119
|
+
IN2 = mod.electrical(name = "IN2", width = 1, direction = "inout")
|
|
120
|
+
CONFIG = mod.dig(name = "CONFIG", domain = VDD, width = 4, value = 0, inCap = 100e-15, direction = "input")
|
|
121
|
+
|
|
122
|
+
#Parameters
|
|
123
|
+
alfa = mod.par(name = "alfa", value = 10.0)
|
|
124
|
+
|
|
125
|
+
#Analog block
|
|
126
|
+
mod.analog(
|
|
127
|
+
va.Branch(IN1, IN2).vCont(va.Branch(IN1, IN2).i*(va.Real(CONFIG.read(signed = False)) + 1)*alfa)
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
#Save veriloga file
|
|
131
|
+
file = open('veriloga.va', 'w')
|
|
132
|
+
file.write(mod.getVA())
|
|
133
|
+
file.close()
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
# More examples
|
|
137
|
+
Extra examples will be added to examples folder
|
vagen-0.0.1/README.md
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# vagen
|
|
2
|
+
|
|
3
|
+
## What is vagen?
|
|
4
|
+
|
|
5
|
+
vagen was created mainly to generate verilogA stimulus for verification of complex analog IPs. However, it has wrappers for most of the verilogA reserved words, so it also generates verilogA models.
|
|
6
|
+
|
|
7
|
+
## Instalation
|
|
8
|
+
|
|
9
|
+
You can install vagen by typing the command:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
pip3 install vagen
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Example 1: Stimulus for verification of a DCDC
|
|
16
|
+
|
|
17
|
+
Let's assume that a stimulus with the following sequence is required:
|
|
18
|
+
|
|
19
|
+
* VDD must rise from 0 to 5.0V in 10us.
|
|
20
|
+
* After 10us, the clock signal (CLK) must start with a frequency of 4MHz. CLK domain is VDD.
|
|
21
|
+
* After 1us, RST must rise. RST domain is VDD.
|
|
22
|
+
* Wait for the positive edge of the signal READY when it crosses half of the domain voltage. READY domain is VDD.
|
|
23
|
+
* A current of 100mA must be drawn from the in OUT with a rise time of 100ns.
|
|
24
|
+
* After 10us, the bus CONFIG_VOUT[3:0] must be changed from 0 to 5. CONFIG_VOUT[3:0] domain is VDD.
|
|
25
|
+
* After 20us, finishes the simulation.
|
|
26
|
+
|
|
27
|
+
The python code that generates this stimulus is shown below:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
import vagen as va
|
|
31
|
+
|
|
32
|
+
#Create a module
|
|
33
|
+
mod = va.HiLevelMod("DCDC_STML")
|
|
34
|
+
|
|
35
|
+
#Create pins
|
|
36
|
+
VDD = mod.vdc(name = "VDD", width = 1, direction = "inout")
|
|
37
|
+
OUT = mod.idc(name = "OUT", width = 1, direction = "inout")
|
|
38
|
+
CLK = mod.clock(mod.dig(name = "CLK", domain = VDD, width = 1, direction = "output", rise = 100e-15, fall = 100e-15))
|
|
39
|
+
RST = mod.dig(name = "RST", domain = VDD, width = 1, value = 0, direction = "output", rise = 100e-15, fall = 100e-15)
|
|
40
|
+
READY = mod.dig(name = "READY", domain = VDD, width = 1, direction = "input")
|
|
41
|
+
CONFIG_VOUT = mod.dig(name = "CONFIG_VOUT", domain = VDD, width = 4, value = 0, direction = "output", rise = 100e-15, fall = 100e-15)
|
|
42
|
+
|
|
43
|
+
#READY positive event
|
|
44
|
+
EVNT_READY = va.Cross(READY.diffHalfDomain, "rising")
|
|
45
|
+
|
|
46
|
+
#Sequence
|
|
47
|
+
mod.seq(True)(
|
|
48
|
+
VDD.setRiseFall(10e-6, 10e-6),
|
|
49
|
+
VDD.applyV(5.0),
|
|
50
|
+
va.WaitUs(10),
|
|
51
|
+
CLK.on(4e6),
|
|
52
|
+
va.WaitUs(1),
|
|
53
|
+
RST.write(True),
|
|
54
|
+
va.WaitSignal(EVNT_READY),
|
|
55
|
+
OUT.setRiseFall(100e-9, 100e-9),
|
|
56
|
+
OUT.applyI(100e-3), #Positive current enters the model
|
|
57
|
+
va.WaitUs(10),
|
|
58
|
+
CONFIG_VOUT.write(5),
|
|
59
|
+
va.WaitUs(20),
|
|
60
|
+
va.Finish()
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
#Save veriloga file
|
|
64
|
+
file = open('veriloga.va', 'w')
|
|
65
|
+
file.write(mod.getVA())
|
|
66
|
+
file.close()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Example 2: More than one sequence in the same veriloga
|
|
70
|
+
|
|
71
|
+
You can create a veriloga parameter called testSeq
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
seqPar = mod.par(name = "testSeq", value = 0)
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
And then use this parameter to select the sequence depending on the value
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
#sequence 1
|
|
81
|
+
mod.seq(seqPar == 1)(
|
|
82
|
+
...
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
#sequence 2
|
|
86
|
+
mod.seq(seqPar == 2)(
|
|
87
|
+
...
|
|
88
|
+
)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Example 3: Model of a configurable resistor
|
|
92
|
+
|
|
93
|
+
As mentioned before, vagen can be used to generate models. As an example, the code below generates a veriloga model of a configurable resistor.
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
import vagen as va
|
|
97
|
+
|
|
98
|
+
#Create a module
|
|
99
|
+
mod = va.HiLevelMod("CONFIG_RES")
|
|
100
|
+
|
|
101
|
+
#Create pins
|
|
102
|
+
VDD = mod.electrical(name = "VDD", width = 1, direction = "inout")
|
|
103
|
+
IN1 = mod.electrical(name = "IN1", width = 1, direction = "inout")
|
|
104
|
+
IN2 = mod.electrical(name = "IN2", width = 1, direction = "inout")
|
|
105
|
+
CONFIG = mod.dig(name = "CONFIG", domain = VDD, width = 4, value = 0, inCap = 100e-15, direction = "input")
|
|
106
|
+
|
|
107
|
+
#Parameters
|
|
108
|
+
alfa = mod.par(name = "alfa", value = 10.0)
|
|
109
|
+
|
|
110
|
+
#Analog block
|
|
111
|
+
mod.analog(
|
|
112
|
+
va.Branch(IN1, IN2).vCont(va.Branch(IN1, IN2).i*(va.Real(CONFIG.read(signed = False)) + 1)*alfa)
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
#Save veriloga file
|
|
116
|
+
file = open('veriloga.va', 'w')
|
|
117
|
+
file.write(mod.getVA())
|
|
118
|
+
file.close()
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
# More examples
|
|
122
|
+
Extra examples will be added to examples folder
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires=["setuptools >= 58.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vagen"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
authors = [{name="Rodrigo Pedroso Mendes", email="roedroso@gmail.com"}]
|
|
9
|
+
description = "Generates verilogA testbench for verification of analog IPs (VLSI design)"
|
|
10
|
+
readme = "README.md"
|
|
11
|
+
requires-python = ">=3.7"
|
|
12
|
+
dependencies = ["regex>=2023.6.3", "datetime>=5.2"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Programming Language :: Python :: 3",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
"Operating System :: OS Independent",
|
|
17
|
+
]
|
|
18
|
+
|
|
19
|
+
[project.urls]
|
|
20
|
+
"Homepage" = "https://github.com/rpm2003rpm/vagen"
|
vagen-0.0.1/setup.cfg
ADDED