Port-binding considerations include case mapping and bus connections between Verilog and SPICE. The following guidelines can help you choose which method to use for your design requirements:
|
Design Requirements |
Port-Binding Method |
|---|---|
|
All buses have uniform ascending/descending port order and all ports have uniform case mapping |
|
|
Customized port binding requirements |
|
|
You have a Verilog version of a SPICE block |
|
|
You need to bind ports by name, rather than by order |
Binding Ports using autobus
To bind Verilog to SPICE ports using autobus, do the following:
- Use an include statement to include the SPICE design file:
include"analog_top.sp" -
Use
portmapandconfigcards in theamsdblock to specify the SPICE file and subcircuits that you have instantiated in Verilog modules:amsd{portmap subckt=analog_top autobus=yes busdelim="<>"config cell=analog_top use=spice}The default value for
autobuson theportmapstatement isyes. - Specify the AMS control file directly on the
xruncommand line:xrun ... amsdcb.scs
Here is an example. The top module, testbench, instantiates one SPICE block, pll_top:
|
The SPICEname identifiers (on the left side of the colon) come from the SPICE subcircuit definition (such as .subckt pll_top refclk reset P0_CLK[1] P0_CLK[0]).
The VerilogName identifiers (on the right side of the colon) represent the port names of the Verilog module that the software generates internally. These port names can be different from the actual interface signal names in the instantiation in the top-level testbench module. In this example, for instance, the interface signal names are refclk , myRESET , and clk_out , while the port names in the port-bind file are refclk , reset , P0_CLK[1] , and P0_CLK[0].
You should change the port directions to match your design requirements ( dir=inout is the default direction setting for SPICE ports).
The software maps P0_CLK[1] and P0_CLK[0] into a bus because [] is the default bus delimiter.
Binding Ports using a Port-Bind File
Some designs require customized port binding, such as mixed-case mapping, more complicated bus forms such as those that include concatenations, and mixed ascending and descending bus orders. You can use a port-bind file to specify your customized port binding requirements.
You can use autobus to generate the initial port-bind file (.pb) automatically, then you can customize the mappings in that file. The general steps you can follow are:
- Use autobus to generate the initial port-bind file (
.pb). - Customize port mappings in the initial port-bind file.
- Use
portmap … file=to specify the port-bind file you customized.include "analog_top.sp"amsd{portmap subckt=analog_top file="analog_top.pb"config cell=analog_top use=spice}
Binding Ports using a Verilog File
If your design contains units for which you have both a Verilog and a SPICE version, you can use a Verilog file to specify your binding options. Perhaps you simulate a purely digital version of your design first, and then selectively replace some blocks with a SPICE version.
You can specify a file containing a Verilog module that defines the port mappings to use from a Verilog parent to a SPICE subcircuit instance using portmap reffile in your AMS control file. This approach lets you replace the interface of a subcircuit with that of a Verilog module.
For example:
include "analog_top.sp"
amsd{
portmap subckt=analog_top reffile="analog_top.v" refformat=verilog
config cell=analog_top use=spice
}
In this example, analog_top.v is the Verilog file that contains the port binding information your design requires. The software applies port bindings (interfaces) defined in analog_top.v to instances of analog_top. While the elaborator uses the port bindings you define for analog_top in analog_top.v to determine how to connect instances of analog_top, the simulator simulates the analog_top subcircuit you define in analog_top.sp.
For example, analog_top.v might contain the following:
|
Binding ports by order is not recommended when the ports in the Verilog reference file and the ports in the equivalent SPICE subcircuit do not match by order. In such situations, it is recommended that you bind ports by name using the porttype=name parameter.
Binding Ports by Name
When you need to bind the ports in your reference file by name, rather than by order, you can use the porttype specifier in a portmap statement. For example:
amsd{
ie vsup=1.8
portmap module=counter reffile="./source/digital/counter.v" porttype=name
config cell=counter use=hdl
}
The software uses this specifier when automatically generating a port-bind file. The default binding mechanism is by-order ( porttype=order ). However, if your design consists mostly of SPICE and Verilog ports that have the same name, but with mismatched port order, you might get a more accurate port-bind file by specifying porttype=name.
If the software cannot match ports between Verilog and SPICE successfully, the elaborator writes " not_found " as a placeholder in the port-bind file it generates (in runDir /portmap_files). You can edit this file to change all not_found keywords to the correct Verilog port names, then use the file parameter (instead of reffile and porttype) in a porttype statement to specify the file you saved, and run the simulation again.
Related Topics
- autobus
- portmap
- porttype
- config
- file
- reffile
- XRUN Invocation for Mixed-Signal Designs
- Creating a Customized Port-Bind File
- Customized Port-Bind Files
