English 中文(简体)
wire equation in verilog [closed]
原标题:
  • 时间:2010-01-20 16:51:00
  •  标签:
  • verilog

If say I have the following wire set-ups, is the wire assignment all valid?

wire[3:1] w;
wire w1;
wire [1:0] w2;

A) w1 = w[2];    
B) w2 = w[1:0];  
C) w2 = w[1:2];

I am guessing that everything is valid....

问题回答

Don t guess. Try to compile the code for yourself. A and B are legal syntax. C is illegal syntax, according to the simulators I tried (VCS and NC-Verilog), assuming you mean:

assign w2 = w[1:2];

The compile error message will be something like "Illegal part select range".

In the IEEE Standard for Verilog (Std 1364-2005), section 5.2.1 "Vector bit-select and part-select addressing", it is stated that the 1st number must address a more significant bit than the 2nd number.





相关问题
How to NOT use while() loops in verilog (for synthesis)?

I ve gotten in the habit of developing a lot testbenches and use for() and while() loops for testing purpose. Thats fine. The problem is that I ve taken this habit over to coding for circuits which ...

Displaying the Verilog parameter name

I am using the parameter keyword to define a state, i.e., RESET = 5 b00000. If I want to use $display to print out the state name instead of the binary representation, or display the state name in my ...

verilog modelsim fpga

Sorry for Newbish question. I am trying to learn about FPGA programming. Before I spend $1K on a FPGA board: if I just want to learn Verilog, can I run it entirely in Modelsim? (I realize there are ...

Assigning wires deep in a nested set of modules

I have a wire that is about 4 levels deep and I really don t want the hassle of having to propagate it up the hierarchy. Is there any way to assign the wire using some sort of referencing? I know I ...

schematic for verilog code that adds three inputs

What does the schematic looks like for the following verilog code? module mystery2(s, c, x, y, z); input x, y, z; output s, c; assign {c, s} = x + y + z; endmodule I know that {c, s} means ...

wire equation in verilog [closed]

If say I have the following wire set-ups, is the wire assignment all valid? wire[3:1] w; wire w1; wire [1:0] w2; A) w1 = w[2]; B) w2 = w[1:0]; C) w2 = w[1:2]; I am guessing that everything is ...

How to wire two modules in Verilog?

I have written two modules DLatch and RSLatch and i want to write verilog code to join those two.

热门标签