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.

FPGA WARNING of initial value is never assigned

Status
Not open for further replies.

myjoe1026

Junior Member level 3
Joined
Jan 7, 2016
Messages
26
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
198
Hi, I'm using Lattice Diamond to compile the following code.
I've written reg [11:0] Data = 12'hABC;
But it keep showing:
WARNING - : using initial value of Data since it is never assigned. VERI-1220

Can anyone tell me how to modify it? Thanks!

Code:
module counter_6(clkin,clkout,dataO);
input clkin;
output reg clkout;
//output wire clk6;
output reg dataO;
reg [15:0] count=16'd0;
reg [4095:0] Dcount  =4096'd0;
reg [11:0] Data = 12'hABC;

	   
always @(posedge clkin)
	begin
		
		if (count < 3'b011)
			begin
			clkout = 1'b1;
			dataO = Data[Dcount];
			end
		if (count == 3'b011)
			begin
			clkout = 1'b0;
			dataO = Data[Dcount];
			end
		if (count == 3'b110)
			begin
			count = 3'b000;
			clkout = 1'b1;
			Dcount = Dcount + 1'b1;
			dataO = Data[Dcount];
			end
		if (Dcount == 4096'd12)	
			begin
			Dcount=4096'd0;
			end
		count = count + 1'b1;
	end
	
endmodule
 
Last edited:

Assign a value to Data somewhere in the code...
 

Yes, thats the initial value
It is never assigned a value in runtime.
 

Yes, thats the initial value
It is never assigned a value in runtime.

Sorry, didn't get it. I just want to output the Data value, which is 12'hABC, I've assigned. Why I have to assign a value in runtime?
 

Sorry, didn't get it. I just want to output the Data value, which is 12'hABC, I've assigned. Why I have to assign a value in runtime?

You dont, what you had was only a warning that you had given a variable an initial value and never updated it - that is exactly what you wanted, so the warning will remain.
 

You dont, what you had was only a warning that you had given a variable an initial value and never updated it - that is exactly what you wanted, so the warning will remain.

Thanks! But my compiler just stopped there. Does it have anything to do with that?
 

Hi, I'm using Lattice Diamond to compile the following code.
I've written reg [11:0] Data = 12'hABC;
But it keep showing:
WARNING - : using initial value of Data since it is never assigned. VERI-1220

Can anyone tell me how to modify it? Thanks!

Code:
module counter_6(clkin,clkout,dataO);
input clkin;
output reg clkout;
//output wire clk6;
output reg dataO;
reg [15:0] count=16'd0;
reg [4095:0] Dcount  =4096'd0;
reg [11:0] Data = 12'hABC;

	   
always @(posedge clkin)
	begin
		
		if (count < 3'b011)
			begin
			clkout = 1'b1;
			dataO = Data[Dcount];
			end
		if (count == 3'b011)
			begin
			clkout = 1'b0;
			dataO = Data[Dcount];
			end
		if (count == 3'b110)
			begin
			count = 3'b000;
			clkout = 1'b1;
			Dcount = Dcount + 1'b1;
			dataO = Data[Dcount];
			end
		if (Dcount == 4096'd12)	
			begin
			Dcount=4096'd0;
			end
		count = count + 1'b1;
	end
	
endmodule

unrelated, but are you sure this code is sane? I mean, Dcount is 4096 bits long, and you are using it as a decoded address. The logic will be huge.
 

unrelated, but are you sure this code is sane? I mean, Dcount is 4096 bits long, and you are using it as a decoded address. The logic will be huge.

Yes, my data is that huge! Seems like it is too huge to run in the compiler. I'll try to separate it into two registers. Thank you guys anyway.
 

Code:
if (Dcount == 4096'd12)	
			begin
			Dcount=4096'd0;
			end

It looks like Dcount ranges from 0 to 12. Dcount is defined for 0 to 2**4096 - 1. (~10**136).

- - - Updated - - -

also you are using blocking assign inside a clocked always block. this makes simulation invalid in most cases.
 

Code:
if (Dcount == 4096'd12)	
			begin
			Dcount=4096'd0;
			end

It looks like Dcount ranges from 0 to 12. Dcount is defined for 0 to 2**4096 - 1. (~10**136).

- - - Updated - - -

also you are using blocking assign inside a clocked always block. this makes simulation invalid in most cases.

I think the OP doesn't understand binary (and addressing) very well.

Given that 4096 is 2**12 and they are using Dcount as an index into Data, which just happens to be 12-bits.
 

Yes, my data is that huge! Seems like it is too huge to run in the compiler. I'll try to separate it into two registers. Thank you guys anyway.

I don't think that will work. See posts above. You got the index wrong, most likely.
 

I think the math in post #11 is wrong...10**136 isn't anywhere closet to 2**4096

2**1024 is already ~1.7977x10**308

so 2**4096 will be (~1.8x10**308)**4 which is closer to something like 10**1233

Basically we are discussing an address (index) into an array bigger than all the memory devices that exist on the earth throughout history.

Of course you can't compile this code.
 
OK! Thanks guys. I've fixed the address (index) and then it worked well!
 

Oh, yeah my math was way off. I did 2**30 as ~1 billion, but then forgot about the "billion" part. I should have use 10**1224 by that logic.

In either case it is significantly larger than 12.

I would have expected this to compile actually. non-power-of-two indexing is already weird -- some tools will add range checks and others will assume power-of-two anyways. In the first case, a 4096b compare to constant shouldn't be that bad. Specifically, it shouldn't hang the tools. Timing issues might occur, but that is another issue. In the second case, the upper bits are just ignored.
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top