Can anyone help to intepret this verilog expression?

Status
Not open for further replies.

zhiling0229

Member level 1
Joined
Jul 26, 2006
Messages
34
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,592
Hi,

I'm a noob in verilog language, I was looking through a verilog code an encounter this expression:

parameter DATA_WIDTH = 72

reg [DATA_WIDTH - 1: 0] data;
reg [DATA_WIDTH - 1: 0] ndata;

wire [1:0] data_background

data <= { (DATA_WIDTH + 1) / 2 {data_background}};
ndata <= { (DATA_WIDTH + 1) / 2{~data_background}};

The signal that is going into data_background is 2 b'11

Can anyone help me explain how the not is performed for ~data_background and what does the curly braces means for this case?

Can anyone help me to provide me with the expected output of data and ndata?


Thanks a million
 

That's basic verilog syntax, a concatenation with a repeat factor. In this case, all one is copied to both regs.

You should take the time to learn basic Verilog syntax from a text book to get full benefit from the language.
 

Thanks for the answer.

Your right I need to have to learn more on the verilog basic syntax. Any books that you can recommend to learn the verilog basic syntax?

Hmmm......was wondering:

Why both ndata and data be the same values when one is concatenated with:

data_background and the other is ~data background?

In this case will data_background and ~data_background have the same value? when will it have a different value?
 

zhiling0229 said:
/.../Any books that you can recommend/.../
you can try google and a string: verilog examples OR tutorial;

"~" means not, an inverter;
---
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…