verilog

$display shows unexpected high impedance 'z' output

牧云@^-^@ 提交于 2020-12-13 17:51:36
问题 module hi ( input wire clk, output wire [6:0] a ); wire [7:0] b; assign b= 8'd24; assign a[6:0] = b[7:1]; initial $display ("%d", a); endmodule I get a high impedance 'z' output. Where am i going wrong? 回答1: You didn't give the assign statement a chance to propagate the values on the wires. The initial block executes first. Add a delay before the $display , or use $strobe instead. 来源: https://stackoverflow.com/questions/40035070/display-shows-unexpected-high-impedance-z-output

How to set all the bits to be 0 in a two-dimensional array in Verilog?

柔情痞子 提交于 2020-12-02 07:03:05
问题 I've built a 8*2bits array to represent a piece of memory in Verilog reg [1:0] m [0:7] There is a reset signal for this memory and if reset is 1, all the bits in this memory should be reset to 0. But I don't know how to set all the bits of m in a concise way, because if there are hundreds thousands of bits in the memory, the following way is obviously unfeasible. always@(posedge clk or posedge reset) begin if (reset) begin m[0]<=2'b00; m[1]<=2'b00; m[2]<=2'b00; m[3]<=2'b00; m[4]<=2'b00; m[5]<

How to set all the bits to be 0 in a two-dimensional array in Verilog?

别等时光非礼了梦想. 提交于 2020-12-02 07:00:14
问题 I've built a 8*2bits array to represent a piece of memory in Verilog reg [1:0] m [0:7] There is a reset signal for this memory and if reset is 1, all the bits in this memory should be reset to 0. But I don't know how to set all the bits of m in a concise way, because if there are hundreds thousands of bits in the memory, the following way is obviously unfeasible. always@(posedge clk or posedge reset) begin if (reset) begin m[0]<=2'b00; m[1]<=2'b00; m[2]<=2'b00; m[3]<=2'b00; m[4]<=2'b00; m[5]<

What SystemVerilog features should be avoided in synthesis?

你。 提交于 2020-07-15 02:58:51
问题 SystemVerilog introduced some very useful constructs to improve coding style. However, as one of my coworkers always says, "You are not writing software, you are describing hardware." With that in mind, what features of the language should be avoided when the end result needs to be synthesized? This paper shows what features are currently synthesizable by the Synopsys tools, but to be safe I think one should only use the features that are synthesizable by all of the major vendors. Also, what