Skip to content
Snippets Groups Projects
Commit 416acb98 authored by Thomas Kramer's avatar Thomas Kramer
Browse files

issue #12: connect ground net to `0` if has different name

* If the ground net is called VSS or similar, then it needs to be
  connected to GND or 0
parent 644aacec
No related branches found
No related tags found
No related merge requests found
...@@ -73,7 +73,7 @@ def characterize_input_capacitances( ...@@ -73,7 +73,7 @@ def characterize_input_capacitances(
setup_statements_string = "\n".join(setup_statements) setup_statements_string = "\n".join(setup_statements)
# Add output load capacitance. Right now this is 1fF. # Add output load capacitance. Right now this is 1fF.
output_load_statements = "\n".join((f"Cload_{p} {p} GND 1f" for p in output_pins)) output_load_statements = "\n".join((f"Cload_{p} {p} {cell_conf.ground_net} 1f" for p in output_pins))
# Choose a maximum time to run the simulation. # Choose a maximum time to run the simulation.
time_max = cfg.time_step * 1e6 time_max = cfg.time_step * 1e6
...@@ -88,6 +88,18 @@ def characterize_input_capacitances( ...@@ -88,6 +88,18 @@ def characterize_input_capacitances(
logger.debug("Measuring input capacitance.") logger.debug("Measuring input capacitance.")
# If the ground net is not called GND, then it must be connected to GND or 0.
# This seems to be a must for SPICE simulators.
# See: https://codeberg.org/librecell/lctime/issues/12#issuecomment-2173526
if cell_conf.ground_net not in ["GND", "gnd", "0"]:
logger.debug(f"Connect ground net `{cell_conf.ground_net}` to simulators ground `0`.")
ground_connection = f"* Connect ground net to GND\n" \
f"vgnd {cell_conf.ground_net} 0 0"
else:
# Using standard name for ground net.
ground_connection = ""
# Generate all possible input combinations for the static input pins. # Generate all possible input combinations for the static input pins.
static_input_nets = [i for i in input_pins_non_inverted if i != active_pin] static_input_nets = [i for i in input_pins_non_inverted if i != active_pin]
num_inputs = len(static_input_nets) num_inputs = len(static_input_nets)
...@@ -178,6 +190,8 @@ pre_set strict_errorhandling ...@@ -178,6 +190,8 @@ pre_set strict_errorhandling
{setup_statements_string} {setup_statements_string}
{ground_connection}
Xcircuit_under_test {" ".join(ports)} {cell_conf.cell_name} Xcircuit_under_test {" ".join(ports)} {cell_conf.cell_name}
{output_load_statements} {output_load_statements}
......
...@@ -100,6 +100,16 @@ def simulate_cell( ...@@ -100,6 +100,16 @@ def simulate_cell(
# Load include files. # Load include files.
setup_statements_string = "\n".join(setup_statements) setup_statements_string = "\n".join(setup_statements)
# If the ground net is not called GND, then it must be connected to GND or 0.
# This seems to be a must for SPICE simulators.
# See: https://codeberg.org/librecell/lctime/issues/12#issuecomment-2173526
if ground_net not in ["GND", "gnd", "0"]:
logger.debug(f"Connect ground net `{cell_conf.ground_net}` to simulators ground `0`.")
ground_connection = f"* Connect ground net to GND\n" \
f"vgnd {ground_net} 0 0"
else:
ground_connection = ""
input_voltages_static = dict() input_voltages_static = dict()
input_voltages_active = dict() input_voltages_active = dict()
...@@ -196,6 +206,8 @@ pre_set strict_errorhandling ...@@ -196,6 +206,8 @@ pre_set strict_errorhandling
{setup_statements_string} {setup_statements_string}
{ground_connection}
Xcircuit_under_test {" ".join(cell_ports)} {cell_name} Xcircuit_under_test {" ".join(cell_ports)} {cell_name}
* Output load capacitances. * Output load capacitances.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment