Languages
I am converting a digital signal 'A' to an analog signal 'B' using one of the connector primitives of XMODEL and the logic X values contained in 'A' are causing some problems for me. Is there a way to convert the logic X values into either 0 or 1 depending on my needs? For example, I'd like to convert all logic X values into 1's in some cases, and convert all logic X values to 0's in some other cases.
To address your needs, we've introduced new parameters named 'valueX'
and 'valueZ'
to the following primitives with digital inputs, starting with the XMODEL 2024.09 Release.
xbit_to_xreal
xbit_to_real
bit_to_xreal
bit_to_real
xbit_to_xreal_var
xbit_to_real_var
bit_to_xreal_var
bit_to_real_var
bit_to_xbit
xbit_to_bit
buf_xbit
inv_xbit
transition
switch
The parameters 'valueX'
and 'valueZ'
define the mapped values of the logic X and logic Z values of the input signal, respectively, so that they can be treated equivalently as a different logic value, for example, logic 0 or 1. For example, when 'valueX'
is set to 1, all the logic X values of the input will be treated as logic 1. Similarly, when 'valueZ'
is set to 0, all the logic Z values of the input will be treated as logic 0. Therefore, you can use these parameters to suppress the logic X or logic Z values into logic 0 or 1 values.
Here is a simple example to demonstrate the usage of the parameters 'valueX'
and 'valueZ'
. The testbench shown below converts a 'reg'
-type signal 'in'
to an 'xbit'
-type signal 'out_D'
using a 'bit_to_xbit'
primitive, and to an 'xreal'
-type signal 'out_A'
using a 'bit_to_xreal'
primitive. The input signal 'in'
contains some logic X and logic Z values.
TB_conn.sv:
module TB_conn; reg in; xbit out_D; xreal out_A; bit_to_xbit CONN1 (.in(in), .out(out_D)); bit_to_xreal #(.level0(0.0), .level1(1.2), .rise_time(1e-9), .fall_time(1e-9)) CONN2 (.in(in), .out(out_A)); initial begin in = 1'b0; #(8ns) in = 1'b1; #(8ns) in = 1'b0; #(8ns) in = 1'b1; #(8ns) in = 1'b0; #(8ns) in = 1'bx; #(8ns) in = 1'b1; #(8ns) in = 1'bx; #(8ns) in = 1'b0; #(8ns) in = 1'bz; #(8ns) in = 1'b1; #(8ns) in = 1'bz; #(8ns) in = 1'b0; end initial begin $xmodel_dumpfile("xmodel.jez"); $xmodel_dumpvars(); end endmodule
Shown below are the simulated waveforms using this testbench. Without the parameters 'valueX'
and 'valueZ'
defined, the 'bit_to_xbit'
primitive propagates the logic X and logic Z values to the signal 'out_D'
as-is. And the 'bit_to_xreal'
primitive ignores the logic X and logic Z values of the input and holds the output signal 'out_A'
steady. In other words, the output value of the 'bit_to_xreal'
primitive when the input has a logic X or logic Z value depends on its previous output value.
Let's see what happens when we define the 'valueX'
and 'valueZ'
parameters for these primitives. For example, the following modifications set 'valueX'
of the 'bit_to_xbit'
primitive to 1 and 'valueZ'
of the 'bit_to_xreal'
primitive to 0. It means, the 'bit_to_xbit'
primitive will treat the logic X values of the input as logic 1 values, and the 'bit_to_xreal'
primitive will treat the logic Z values of the input as logic 0 values.
bit_to_xbit #(.valueX(1)) CONN1 (.in(in), .out(out_D)); bit_to_xreal #(.level0(0.0), .level1(1.2), .rise_time(1e-9), .fall_time(1e-9), .valueZ(0)) CONN2 (.in(in), .out(out_A));
The simulated waveforms confirm that the primitives do work as expected. The signal 'out_D'
has logic-1 values when the input has logic-X values, and the signal 'out_A'
has the values of 0.0 when the input has logic-Z values.
Please login or Register to submit your answer
XMODEL의 connector primitive를 사용하여 디지털 신호 'A'를 아날로그 신호 'B'로 변환하고 있습니다. 그런데, 'A' 신호에 담겨있는 로직 X 값들이 좀 문제가 되고 있습니다. 디지털 신호에 담겨 있는 로직 X 값들을 제 선택에 따라 0 또는 1로 바꾸는 방법이 있나요? 예를 들면, 어떤 경우에는 모든 로직 값들을 1로, 또 다른 경우에는 모든 로직 값들을 0으로 바꾸고 싶습니다.
To address your needs, we've introduced new parameters named 'valueX'
and 'valueZ'
to the following primitives with digital inputs, starting with the XMODEL 2024.09 Release.
xbit_to_xreal
xbit_to_real
bit_to_xreal
bit_to_real
xbit_to_xreal_var
xbit_to_real_var
bit_to_xreal_var
bit_to_real_var
bit_to_xbit
xbit_to_bit
buf_xbit
inv_xbit
transition
switch
The parameters 'valueX'
and 'valueZ'
define the mapped values of the logic X and logic Z values of the input signal, respectively, so that they can be treated equivalently as a different logic value, for example, logic 0 or 1. For example, when 'valueX'
is set to 1, all the logic X values of the input will be treated as logic 1. Similarly, when 'valueZ'
is set to 0, all the logic Z values of the input will be treated as logic 0. Therefore, you can use these parameters to suppress the logic X or logic Z values into logic 0 or 1 values.
Here is a simple example to demonstrate the usage of the parameters 'valueX'
and 'valueZ'
. The testbench shown below converts a 'reg'
-type signal 'in'
to an 'xbit'
-type signal 'out_D'
using a 'bit_to_xbit'
primitive, and to an 'xreal'
-type signal 'out_A'
using a 'bit_to_xreal'
primitive. The input signal 'in'
contains some logic X and logic Z values.
TB_conn.sv:
module TB_conn; reg in; xbit out_D; xreal out_A; bit_to_xbit CONN1 (.in(in), .out(out_D)); bit_to_xreal #(.level0(0.0), .level1(1.2), .rise_time(1e-9), .fall_time(1e-9)) CONN2 (.in(in), .out(out_A)); initial begin in = 1'b0; #(8ns) in = 1'b1; #(8ns) in = 1'b0; #(8ns) in = 1'b1; #(8ns) in = 1'b0; #(8ns) in = 1'bx; #(8ns) in = 1'b1; #(8ns) in = 1'bx; #(8ns) in = 1'b0; #(8ns) in = 1'bz; #(8ns) in = 1'b1; #(8ns) in = 1'bz; #(8ns) in = 1'b0; end initial begin $xmodel_dumpfile("xmodel.jez"); $xmodel_dumpvars(); end endmodule
Shown below are the simulated waveforms using this testbench. Without the parameters 'valueX'
and 'valueZ'
defined, the 'bit_to_xbit'
primitive propagates the logic X and logic Z values to the signal 'out_D'
as-is. And the 'bit_to_xreal'
primitive ignores the logic X and logic Z values of the input and holds the output signal 'out_A'
steady. In other words, the output value of the 'bit_to_xreal'
primitive when the input has a logic X or logic Z value depends on its previous output value.
Let's see what happens when we define the 'valueX'
and 'valueZ'
parameters for these primitives. For example, the following modifications set 'valueX'
of the 'bit_to_xbit'
primitive to 1 and 'valueZ'
of the 'bit_to_xreal'
primitive to 0. It means, the 'bit_to_xbit'
primitive will treat the logic X values of the input as logic 1 values, and the 'bit_to_xreal'
primitive will treat the logic Z values of the input as logic 0 values.
bit_to_xbit #(.valueX(1)) CONN1 (.in(in), .out(out_D)); bit_to_xreal #(.level0(0.0), .level1(1.2), .rise_time(1e-9), .fall_time(1e-9), .valueZ(0)) CONN2 (.in(in), .out(out_A));
The simulated waveforms confirm that the primitives do work as expected. The signal 'out_D'
has logic-1 values when the input has logic-X values, and the signal 'out_A'
has the values of 0.0 when the input has logic-Z values.
Please login or Register to submit your answer