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
Assign a value to Data somewhere in the code...
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?
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.
if (Dcount == 4096'd12)
begin
Dcount=4096'd0;
end
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.
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.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?