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.

Non-constant part select error in Verilog!

Status
Not open for further replies.

rocking

Newbie level 2
Newbie level 2
Joined
Apr 15, 2006
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,295
verilog variable part select

Hi!

I'm trying to execute the following statement:

var[119-i:112-i] <= temp;

I get an error that says non-constant part select index.

What I am trying to do is that I have a 120 bit register called var. I'm getting an 8 bit value called temp from combinational logic and I want to assign it to the 1st 8 MSBs of var i.e. from var[119:112]. Then for the second value of temp, I want to assign it to var[111:104] and so on till var is filled.

any help would be greatly appreciated!

Thanks
 

verilog part select

this should work..

wire [127:0] var;
reg [7:0] a [15:0];
reg [3:0] i;

assign var = {a[15], a[14], a[13], a[12], a[11], a[10], a[9], a[8],
a[7], a[6], a[5], a[4], a[3], a[2], a[1], a[0]};

always @ (posedge clk)
begin
a <= temp;
i <= i + 1'b1;
end
 

    rocking

    Points: 2
    Helpful Answer Positive Rating
part select in verilog

This proved very helpful!
Thanks!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top