Languages

CommunityCategory: MODELZENWhy does MODELZEN turn all the ports into input ports?

MODELZEN

Why does MODELZEN turn all the ports into input ports?

SA Support Team Staff 2020-08-31

It has come to my attention that MODELZEN turns all the ports into input ports. For example, when I extract a model from a simple CMOS inverter with input and output ports as shown below, MODELZEN turns the output port ‘out’ into an input port. Isn’t it wrong? Why does MODELZEN do this?

1 Answers
Best Answer
SA Support Team Staff 2020-08-31

Don’t worry – it is the correct behavior of MODELZEN. MODELZEN may change the directions of the ports when generating models so that the generated models would simulate in SystemVerilog without errors. In other words, your inverter model will correctly produce the output waveform responding to the input.

XMODEL has a unique capability of simulating circuit-level models (CLMs) within SystemVerilog, while SystemVerilog itself only supports the simulation of block-level models. In circuit-level models, their node voltages and branch currents are governed by circuit equations and must be solved simultaneously accounting for their bidirectional interactions. In block-level models, the output of each block or module is determined by its inputs only. This is basically why shorting two output ports in SystemVerilog gives an error. There can be only one driver for a given signal, particularly for so-called “variable-type” signals like xreal and xbit.

Defining the ports of the circuit-level models (i.e. the models made of circuit primitives such as nmosfet and pmosfet) as inputs is a way of avoiding this multiple-driver error in SystemVerilog. In other words, SystemVerilog won’t complain even when you take two of these inverters and short their inputs and outputs together to increase the drive strength.

This is also the reason why all the ports of the XMODEL’s circuit primitives are defined as inputs. Yet, the XMODEL simulation engine treats all their ports as bidirectional ports and computes their voltages and currents via its efficient, event-driven algorithm.

It is noteworthy that MODELZEN doesn’t just turn all the ports into input ports. It knows when it must use output ports, for example, when the generated models contain function primitives such as buffer or connect primitives such as xreal_to_bit. The default behavior of MODELZEN is to ignore the port directions described in the source schematics and determine the proper port directions itself based on the types of primitives connected to each port. You can disable this behavior by the setting the ‘ignore_pindir’ option to False in the technology configuration file as shown below:

devo_options['ignore_pindir'] = False

But doing so is not recommended in general as you may encounter various errors and issues due to the conflicts in port directions.

MODELZEN

왜 MODELZEN은 모든 포트를 입력포트로 바꾸나요?

SA Support Team Staff 2020-08-31

MODELZEN은 모델을 생성할때 모든 포트를 입력포트로 생성하는 것 같습니다. 예를 들어, 아래처럼 입력과 출력 포트를 모두 가진 간단한 CMOS 인버터 회로에서 모델을 추출해보면, MODELZEN이 생성한 모델에는 출력포트인 ‘out’이 입력포트로 표현되어 있음을 알 수 있습니다. 이것은 오류 아닌가요? MODELZEN이 이렇게 하는 이유가 뭐죠?

1 Answers
Best Answer
SA Support Team Staff 2020-08-31

Don’t worry – it is the correct behavior of MODELZEN. MODELZEN may change the directions of the ports when generating models so that the generated models would simulate in SystemVerilog without errors. In other words, your inverter model will correctly produce the output waveform responding to the input.

XMODEL has a unique capability of simulating circuit-level models (CLMs) within SystemVerilog, while SystemVerilog itself only supports the simulation of block-level models. In circuit-level models, their node voltages and branch currents are governed by circuit equations and must be solved simultaneously accounting for their bidirectional interactions. In block-level models, the output of each block or module is determined by its inputs only. This is basically why shorting two output ports in SystemVerilog gives an error. There can be only one driver for a given signal, particularly for so-called “variable-type” signals like xreal and xbit.

Defining the ports of the circuit-level models (i.e. the models made of circuit primitives such as nmosfet and pmosfet) as inputs is a way of avoiding this multiple-driver error in SystemVerilog. In other words, SystemVerilog won’t complain even when you take two of these inverters and short their inputs and outputs together to increase the drive strength.

This is also the reason why all the ports of the XMODEL’s circuit primitives are defined as inputs. Yet, the XMODEL simulation engine treats all their ports as bidirectional ports and computes their voltages and currents via its efficient, event-driven algorithm.

It is noteworthy that MODELZEN doesn’t just turn all the ports into input ports. It knows when it must use output ports, for example, when the generated models contain function primitives such as buffer or connect primitives such as xreal_to_bit. The default behavior of MODELZEN is to ignore the port directions described in the source schematics and determine the proper port directions itself based on the types of primitives connected to each port. You can disable this behavior by the setting the ‘ignore_pindir’ option to False in the technology configuration file as shown below:

devo_options['ignore_pindir'] = False

But doing so is not recommended in general as you may encounter various errors and issues due to the conflicts in port directions.