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.

Assigning to a parameterized 2d Verilog array

Status
Not open for further replies.

shaiko

Advanced Member level 5
Advanced Member level 5
Joined
Aug 20, 2011
Messages
2,644
Helped
303
Reputation
608
Reaction score
297
Trophy points
1,363
Activity points
18,302
Hello,

I have a Verilog array defined as :
logic [0:num_elements-1] [element_width] some_array ;

I want to assign every array element with a vector that is all ones: "11...1".
I tried this but I get an error:
Code:
some_array <= { num_elements { element_width { 1'b1 } } } ;
What's the correct syntax ?
 

I am not a Verilog guy.....

But can't you assign each elements of the array inside a double-loop?
 

I can, but I'm looking for a single liner - like VHDL's :
Code:
some_array <= ( others => ( others => '1' ) ) ;
 

Just assign it directly as you defined it as a packed array format


Code Verilog - [expand]
1
some_array <= {num_elements*element_width{1'b1}};


--- Updated ---

If you had defined it using an unpacked array format then you would use a for loop to set each element.
 
  • Like
Reactions: shaiko

    shaiko

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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top