Languages

CommunityCategory: XMODELSuppressing ‘x’ or ‘z’ in xbit-type signals

XMODEL

Suppressing ‘x’ or ‘z’ in xbit-type signals

SA Support Team Staff 2020-12-24

An xbit-type signal can take four values: 1, 0, x, and z. While I understand the need for x (unknown) and z (high impedance) values, sometimes I just want to suppress them to zeros to avoid problems in the subsequent blocks that use the signal. For wire/reg-type signals, this is easy. How can I do it for xbit-type signals?

1 Answers
Best Answer
SA Support Team Staff 2020-12-24

One way to suppress 'x' and 'z' values in xbit-type signals to 0's is to use buf_xbit or inv_xbit primitive. These primitives have a parameter named 'twostate'. When this parameter has a non-zero value (e.g. 1), the primitive outputs 0 whenever the input is 'x' or 'z'.

For example, the following buf_xbit and inv_xbit instances will produce 0 as outputs when their input in is 'x' or 'z'.

buf_xbit #(.twostate(1)) X1 (.in(in), .out(Y));
inv_xbit #(.twostate(1)) X2 (.in(in), .out(Z));

When composing model schematics in GLISTER, you can enable this 'twostate' parameter for a buf_xbit or inv_xbit instance by selecting the Force 2-State Output option in its Edit Object Properties window as shown below.

XMODEL

xbit 타입 신호의 ‘x’와 ‘z’ 값 제거하는 법

SA Support Team Staff 2020-12-24

xbit 타입 신호는 1, 0, x, 그리고 z의 4가지 값을 가질 수 있습니다. Unknown 상태를 의미하는 xhigh impedance 상태를 의미하는 z 값이 왜 필요한지는 잘 이해하고 있습니다만, 가끔은 신호가 xz값 없이 01만으로 표현되었으면 하는 때가 있습니다. 특히 그 신호를 입력으로 사용하는 블럭들에서 xz값이 문제를 일으킬 때가 그렇습니다. wirereg 타입 신호에서는 코드를 사용해 xz값을 모두 0으로 쉽게 바꿀 수 있는데, xbit 타입 신호에 대해서는 어떻게 하면 되나요?

1 Answers
Best Answer
SA Support Team Staff 2020-12-24

One way to suppress 'x' and 'z' values in xbit-type signals to 0's is to use buf_xbit or inv_xbit primitive. These primitives have a parameter named 'twostate'. When this parameter has a non-zero value (e.g. 1), the primitive outputs 0 whenever the input is 'x' or 'z'.

For example, the following buf_xbit and inv_xbit instances will produce 0 as outputs when their input in is 'x' or 'z'.

buf_xbit #(.twostate(1)) X1 (.in(in), .out(Y));
inv_xbit #(.twostate(1)) X2 (.in(in), .out(Z));

When composing model schematics in GLISTER, you can enable this 'twostate' parameter for a buf_xbit or inv_xbit instance by selecting the Force 2-State Output option in its Edit Object Properties window as shown below.