Skip to content

Commit d50ca41

Browse files
author
jehess
committed
Cadence lib, updated unix opt handling, and tests
1 parent cc6e3f9 commit d50ca41

Some content is hidden

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

54 files changed

+317
-74
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -134,3 +134,4 @@ dmypy.json
134134

135135
# Pyre type checker
136136
.pyre/
137+
morpheus/tests/.cadence/dfII/history/

.vscode/launch.json

+9-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"name": "Python: Schematic Test",
99
"type": "python",
1010
"request": "launch",
11-
"program": "morpheus/tests/schematictest.py",
11+
"program": "tests/schematictest.py",
1212
"console": "integratedTerminal",
1313
"justMyCode": true
1414
},
@@ -18,6 +18,14 @@
1818
"request": "launch",
1919
"module": "morpheus",
2020
"justMyCode": true
21+
},
22+
{
23+
"name": "Python: Module no GUI",
24+
"type": "python",
25+
"request": "launch",
26+
"module": "morpheus",
27+
"args": ["--nograph"],
28+
"justMyCode": true
2129
}
2230
]
2331
}

morpheus/CadenceRunner.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
3+
4+
import subprocess
5+
6+
7+
class cadenceRunner:
8+
def __init__(self,pin) -> None:
9+
subprocess.run(["virtuoso", "-nograph"])

morpheus/Schematic.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def __init__(self,ws,lib,DUT,config, tconfig) -> None:
2222
self.terminals = dict()
2323
self.instances = dict()
2424
self.evaluatedPins = list()
25-
self.config.Build = list()
25+
if(hasattr(self.config,"Build")):
26+
self.config.Build = list()
2627

2728
def reevaluate(self, pins):
2829
self.evaluatedPins = pins

morpheus/Test_bench_definitions/Schematics/opamp.yml

+27-5
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,41 @@ name: "OPAMP"
22
type: "terminal"
33

44
Terminals:
5-
5+
- name: "vss"
6+
type: "vss"
7+
term: "dc"
8+
pattern: "vss"
9+
region: 0
10+
#parameters:
11+
# vdc: "vss"
12+
13+
- name: "vdd"
14+
type: "vdd"
15+
term: "dc"
16+
pattern: "vdd"
17+
region: 0
18+
19+
- name: "postive"
20+
type: "postive"
21+
term: "dc"
22+
pattern: "v2"
23+
region: 0
24+
625
- name: "negative"
26+
type: "negative"
727
term: "dc"
8-
pattern: ""
28+
pattern: "v1"
929
region: 0
1030

1131
- name: "postive"
32+
type: "postive"
1233
term: "dc"
13-
pattern: ""
34+
pattern: "v2"
1435
region: 0
1536

1637
- name: "output"
17-
term: "dc"
18-
pattern: ""
38+
type: "output"
39+
term: "dc"
40+
pattern: "vo"
1941
region: 0
2042

morpheus/UnixOptions.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def __add_options(parser):
2+
"""
3+
Add the `Schematic` options
4+
"""
5+
parser.add_argument(
6+
"--id",
7+
metavar="ID",
8+
default="default",
9+
help="What the skillbridge id is (default: default)",
10+
)
11+
parser.add_argument(
12+
"--nograph",
13+
action="store_true",
14+
help="Run without GUI (default: FALSE)",
15+
)

morpheus/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""Cadence Virtuoso Maestro test bench generator"""
2-
__version__ = '0.0.0'
2+
__version__ = '0.0.0'
3+
from morpheus import Schematic

morpheus/__main__.py

+112-10
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,119 @@
11
import argparse
2+
from morpheus import UnixOptions
23
from morpheus.GUIController import *
4+
from morpheus.Schematic import *
35

4-
6+
from morpheus import __version__
57
import os
6-
def main():
8+
9+
from collections import defaultdict
10+
11+
12+
13+
14+
#borrowed and modified from pyinstaller
15+
16+
# This is used by the ``--debug`` option.
17+
class _SmartFormatter(argparse.HelpFormatter):
18+
def _split_lines(self, text, width):
19+
if text.startswith('R|'):
20+
# The underlying implementation of ``RawTextHelpFormatter._split_lines`` invokes this; mimic it.
21+
return text[2:].splitlines()
22+
else:
23+
# Invoke the usual formatter.
24+
return super()._split_lines(text, width)
25+
def __add_options(parser):
26+
parser.add_argument(
27+
'-v',
28+
'--version',
29+
action='version',
30+
version=__version__,
31+
help='Show program version info and exit.',
32+
)
33+
class _MorphArgumentParser(argparse.ArgumentParser):
34+
def __init__(self, *args, **kwargs):
35+
self._morph_action_groups = defaultdict(list)
36+
super().__init__(*args, **kwargs)
37+
38+
def _add_options(self, __add_options: callable, name: str = ""):
39+
"""
40+
Mutate self with the given callable, storing any new actions added in a named group
41+
"""
42+
n_actions_before = len(getattr(self, "_actions", []))
43+
__add_options(self) # preserves old behavior
44+
new_actions = getattr(self, "_actions", [])[n_actions_before:]
45+
self._morph_action_groups[name].extend(new_actions)
46+
47+
def _option_name(self, action):
48+
"""
49+
Get the option name(s) associated with an action
50+
51+
For options that define both short and long names, this function will
52+
return the long names joined by "/"
53+
"""
54+
longnames = [name for name in action.option_strings if name.startswith("--")]
55+
if longnames:
56+
name = "/".join(longnames)
57+
else:
58+
name = action.option_strings[0]
59+
return name
60+
61+
def _forbid_options(self, args: argparse.Namespace, group: str, errmsg: str = ""):
62+
"""Forbid options from a named action group"""
63+
options = defaultdict(str)
64+
for action in self._pyi_action_groups[group]:
65+
dest = action.dest
66+
name = self._option_name(action)
67+
if getattr(args, dest) is not self.get_default(dest):
68+
if dest in options:
69+
options[dest] += "/"
70+
options[dest] += name
71+
72+
# if any options from the forbidden group are not the default values,
73+
# the user must have passed them in, so issue an error report
74+
if options:
75+
sep = "\n "
76+
bad = sep.join(options.values())
77+
if errmsg:
78+
errmsg = "\n" + errmsg
79+
raise SystemExit(f"option(s) not allowed:{sep}{bad}{errmsg}")
80+
81+
82+
def generate_parser() -> _MorphArgumentParser:
83+
"""
84+
Build an argparse parser for morpheus's main CLI.
85+
"""
86+
87+
parser = _MorphArgumentParser(formatter_class=_SmartFormatter)
88+
parser.prog = "morpheus"
89+
90+
parser._add_options(__add_options)
91+
parser._add_options(UnixOptions.__add_options, name="schematic")
92+
93+
94+
95+
return parser
96+
97+
def main(morph_args: list | None = None):
798
parser = argparse.ArgumentParser(
899
prog='Morpheus',
9100
description='Testbench Generator',
10101
epilog='Run --help for options (not ready yet!)')
11102
parser.add_argument('-c', '--cell')
12103
parser.add_argument('-l', '--lib')
13-
parser.add_argument('-i', '--id')
104+
#parser.add_argument('-i', '--id')
14105

15-
args = parser.parse_args()
106+
#args = parser.parse_args()
107+
108+
#new parser
109+
parser = generate_parser()
110+
if morph_args is None:
111+
morph_args = sys.argv[1:]
112+
try:
113+
index = morph_args.index("--")
114+
except ValueError:
115+
index = len(morph_args)
116+
args = parser.parse_args(morph_args[:index])
16117
try:
17118
cell= args.cell
18119
except:
@@ -21,14 +122,15 @@ def main():
21122
lib = args.lib
22123
except:
23124
lib = ""
24-
25-
id = args.id
26-
if not id:
125+
126+
try:
127+
id = args.id
128+
except:
27129
id = os.getenv("USER")
28130

29131

30132

31-
32-
Controller = GUIController(id)
33-
Controller.startGUI()
133+
if not args.nograph:
134+
Controller = GUIController(id)
135+
Controller.startGUI()
34136
main()

morpheus/tests/morpheus/data.dm

-3.29 KB
Binary file not shown.

morpheus/tests/morpheus/iopamp/artSimInfoCDF.att

-40
This file was deleted.
-3.16 KB
Binary file not shown.
-2.69 KB
Binary file not shown.
Binary file not shown.
-2.69 KB
Binary file not shown.
Binary file not shown.

morpheus/tests/schematictest.py

-15
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
("opamp_AUTO_TB:/\topamp_AUTO_TB morpheus_tests schematic_OPAMP" (("open" (nil hierarchy "/{morpheus_tests opamp_AUTO_TB schematic_OPAMP }:a"))) (((-10.54375 -10.70625) (11.53125 0.24375)) "a" "Schematics" 2))("OPAMP:/\tOPAMP morpheus symbol" (("open" (nil hierarchy "/{morpheus OPAMP symbol }:a"))) (((-3.2 -2.5) (3.2 2.50625)) "a" "Symbol" 2))
File renamed without changes.
+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
SOFTINCLUDE /home/jehess/cds.lib
22
DEFINE morpheus /home/jehess/morpheus/tests/morpheus
3+
DEFINE morpheus_tests /home/jehess/morpheus/tests/morpheus_tests

tests/libManager.log.cdslck

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Edit Lock-Stake file. CAUTION: Please do not change.
3+
#
4+
# Information about current Edit Lock Owner.
5+
#
6+
LockStakeVersion 1.1
7+
LoginName jehess
8+
HostName linuxvdi-40.ece.iastate.edu
9+
ProcessIdentifier 12275
10+
ProcessCreationTime_UTC 1697212057
11+
ProcessCreationTime_Readable Fri Oct 13 10:47:37 2023 CDT
12+
AppIdentifier /usr/local/cadence/ic/tools/dfII/bin/64bit/libManager
13+
OSType lnx86
14+
ReasonForPlacingEditLock log file
15+
FilePathUsedToEditLock /home/jehess/morpheus/tests/libManager.log
16+
TimeEditLocked Fri Oct 13 10:47:48 2023 CDT
File renamed without changes.
File renamed without changes.

tests/morpheus_tests/data.dm

3.14 KB
Binary file not shown.

tests/morpheus_tests/opamp/data.dm

3.93 KB
Binary file not shown.
3.35 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
-- Master.tag File, Rev:1.0
2-
symbol.oa
2+
sch.oa
34.1 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Edit Lock-Stake file. CAUTION: Please do not change.
3+
#
4+
# Information about current Edit Lock Owner.
5+
#
6+
LockStakeVersion 1.1
7+
LoginName work
8+
HostName work-eda
9+
ProcessIdentifier 3463
10+
ProcessCreationTime_UTC 1692611550
11+
ProcessCreationTime_Readable Mon Aug 21 17:52:30 2023 CST
12+
AppIdentifier OA File System Design Manager
13+
OSType unix
14+
ReasonForPlacingEditLock OpenAccess edit lock
15+
FilePathUsedToEditLock /home/work/opamp/opamp/schematic/sch.oa.cdslck.dirlck
16+
TimeEditLocked Mon Aug 21 17:53:08 2023 CST
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#
2+
# Edit Lock-Stake file. CAUTION: Please do not change.
3+
#
4+
# Information about current Edit Lock Owner.
5+
#
6+
LockStakeVersion 1.1
7+
LoginName work
8+
HostName work-eda
9+
ProcessIdentifier 3463
10+
ProcessCreationTime_UTC 1692611550
11+
ProcessCreationTime_Readable Mon Aug 21 17:52:30 2023 CST
12+
AppIdentifier OA File System Design Manager
13+
OSType unix
14+
ReasonForPlacingEditLock OpenAccess edit lock
15+
FilePathUsedToEditLock /home/work/opamp/opamp/schematic/sch.oa.cdslck.dirlck
16+
TimeEditLocked Mon Aug 21 17:53:08 2023 CST
Loading
22.6 KB
Binary file not shown.
Loading
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
-- Master.tag File, Rev:1.0
2+
sch.oa
Binary file not shown.

0 commit comments

Comments
 (0)