Skip to content

Commit

Permalink
Merge pull request #93 from mole99/documentation
Browse files Browse the repository at this point in the history
Overhaul Documentation Generation
  • Loading branch information
mole99 authored Aug 8, 2024
2 parents d3ba75c + 4e3f6da commit 5b34734
Show file tree
Hide file tree
Showing 10 changed files with 562 additions and 1,048 deletions.
12 changes: 12 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
# 2.4.1

## CLI

- After successful execution of CACE, the documentation is generated under the specified path "documentation"
- Generate Markdown summary of the design
- Generate Markdown summary of the results
- Export the symbol as SVG
- Export the schematic as SVG
- Export the layout as PNG
- Added `--nofail` argument

# 2.4.0

## Common
Expand Down
2 changes: 1 addition & 1 deletion cace/__version__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
__version__ = '2.4.0'
__version__ = '2.4.1'

if __name__ == '__main__':
print(__version__, end='')
24 changes: 12 additions & 12 deletions cace/cace_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ def cli():
help='do not display the progress bar',
)
parser.add_argument(
'--save',
type=str,
help='directory to save the summary file to after successful completion',
'--nofail',
action='store_true',
help='do not fail on any errors or failing parameters',
)

# Parse arguments
Expand Down Expand Up @@ -351,17 +351,17 @@ def cli():
elif result['type'] == ResultType.CANCELED:
returncode = 4

# Upon successful completion save the summary file
if returncode == 0 and args.save:
if not os.path.isdir(args.save):
err('Save argument is not a directory!')
returncode = 1
else:
with open(os.path.join(args.save, 'summary.md'), 'w') as ofile:
ofile.write(summary)
# Create the documentation
if returncode == 0 or args.nofail:
parameter_manager.generate_documentation()
else:
info(f'CACE failed, skipping documentation generation.')

# Exit with final status
sys.exit(returncode)
if args.nofail:
sys.exit(0)
else:
sys.exit(returncode)


if __name__ == '__main__':
Expand Down
57 changes: 29 additions & 28 deletions cace/common/cace_regenerate.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ def regenerate_rcx_netlist(datasheet, runtime_options):
if not os.path.exists(rcx_netlist_path):
os.makedirs(rcx_netlist_path)

rcfile = get_magic_rcfile(datasheet, magicfilename)
rcfile = get_magic_rcfile()
newenv = os.environ.copy()

if 'PDK_ROOT' in datasheet:
Expand Down Expand Up @@ -551,8 +551,30 @@ def regenerate_lvs_netlist(datasheet, runtime_options, pex=False):

info('Extracting LVS netlist from layout…')

# Assemble stdin for magic
magic_input = ''
if magicfilename and os.path.isfile(magicfilename):
magic_input += f'load {magicfilename}\n'
else:
magic_input += f'gds read {gdsfilename}\n'
magic_input += f'load {dname}\n'
# Use readspice to get the port order
magic_input += f'readspice {schem_netlist}\n'

# magic_input += 'select top cell\n'
magic_input += f'select {dname}\n' # TODO?
magic_input += 'expand\n'
magic_input += 'extract path cace_extfiles\n'
magic_input += 'extract all\n'
magic_input += 'ext2spice lvs\n'
if pex == True:
magic_input += 'ext2spice cthresh 0.01\n'
magic_input += f'ext2spice -p cace_extfiles -o {lvs_netlist}\n'
magic_input += 'quit -noprompt\n'

magicargs = ['magic', '-dnull', '-noconsole', '-rcfile', rcfile]
dbg('Executing: ' + ' '.join(magicargs))
dbg(f'magic stdin:\n{magic_input}')

mproc = subprocess.Popen(
magicargs,
Expand All @@ -561,39 +583,19 @@ def regenerate_lvs_netlist(datasheet, runtime_options, pex=False):
stderr=subprocess.STDOUT,
cwd=root_path,
env=newenv,
universal_newlines=True,
)
if magicfilename and os.path.isfile(magicfilename):
mproc.stdin.write('load ' + magicfilename + '\n')
else:
mproc.stdin.write('gds read ' + gdsfilename + '\n')
mproc.stdin.write('load ' + dname + '\n')
# Use readspice to get the port order
mproc.stdin.write('readspice ' + schem_netlist + '\n')
mproc.stdin.write('select top cell\n')
mproc.stdin.write('expand\n')
mproc.stdin.write('extract path cace_extfiles\n')
mproc.stdin.write('extract all\n')
mproc.stdin.write('ext2spice lvs\n')
if pex == True:
mproc.stdin.write('ext2spice cthresh 0.01\n')
mproc.stdin.write(
'ext2spice -p cace_extfiles -o ' + lvs_netlist + '\n'
text=True,
)
mproc.stdin.write('quit -noprompt\n')

mproc.stdin.write(magic_input)

magout, magerr = mproc.communicate()

dbg(magout)
dbg(magerr)
dbg(f'magic stdout:\n{magout}')
dbg(f'magic stderr:\n{magerr}')

printwarn(magout)
if mproc.returncode != 0:
err(
'Magic process returned error code '
+ str(mproc.returncode)
+ '\n'
)
err(f'Magic process returned error code {mproc.returncode}\n')

if need_lvs_extract and not os.path.isfile(lvs_netlist):
err('No LVS netlist extracted from magic.')
Expand Down Expand Up @@ -882,7 +884,6 @@ def regenerate_schematic_netlist(datasheet, runtime_options):
err(
'Subcircuit ' + mmatch.group(1) + ' was not found!'
)
os.remove(schem_netlist)

if need_schem_capture:
if not os.path.isfile(schem_netlist):
Expand Down
Loading

0 comments on commit 5b34734

Please sign in to comment.