Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Can someone please tell me the meaning of this verilog code:

Status
Not open for further replies.

RaviT

Newbie
Joined
Aug 28, 2016
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
43
parameter data2 = 4;

reg [data2-1:0] data1;
if(data1=={data2{1'b0}})
 

It defines an element "data1" that's 4 bits wide.
And then asks if data1 equal to zero ( "0000" )
 
  • Like
Reactions: RaviT

    RaviT

    Points: 2
    Helpful Answer Positive Rating
This code would not make sense if wrote in the above sequence, anything is assigned to data1.
 

This code would not make sense if wrote in the above sequence, anything is assigned to data1.

Not sure you actually meant to say "nothing" is assigned to data1. Regardless the code does make sense if you add the appropriate sequential structure (initial, always, etc) around the if statement.

currently as written the if statement comparison would always be false (1'b0) as the value of data1 will be 4'bUUUU as it's never assigned anything.
 
  • Like
Reactions: RaviT

    RaviT

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top