0 Members and 1 Guest are viewing this topic.
module Top (input clk, output led);reg [23:0] CNT = 0;reg myled = 1'b1;always @(posedge clk) begin CNT <= CNT + 1'b1; if(CNT == 25000000) begin myled <= !myled; CNT <= 0; endendassign led = myled;endmodule
WARN (EX2998) : Net 'myled' does not have a driverWARN (CV0003) : Output "led" has undriven bits, assigning undriven bits to 0, simulation mismatch possible
Why don't you just "reg myled" and skip the assign statement? I've been writing this way since my first day with FPGAs, and it's always been working.
module Top (input clk, output reg led);
This is some very simple Code for a gowin FPGA, Do you know why I got this warring at synthesize output?Code: [Select]reg [23:0] CNT = 0;
reg [23:0] CNT = 0;
Code: [Select] if(CNT == 25000000) begin myled <= !myled;
if(CNT == 25000000) begin myled <= !myled;
Not all FPGAs have ability to pre-set flip-flops during configuration, which is why it's recommended to have explicit reset sequence unless you target devices which are known to have such functionality.
If CNT can range from 0 to 16,777,215 decimal...
reg [24:0] CNT = 0;
module top(int foo, output bar);reg bar;...endmodule
WARN (EX3628) : Redeclaration of ansi port 'led' is not allowed
module Top (input clk, output led);BaudGenerator #(.Baud(2)) myBaudGen (.i_clk(clk),.o_baudTick(led));endmodule
module BaudGenerator #( parameter Baud = 9600, //Default Baud rate parameter sysClk = 25000000) //System frequency( input i_clk, output reg o_baudTick); localparam [23:0] c_baudAddValue = (16777216.0 * Baud * 4.0) / sysClk; //reg [23:0] c_baudAddValue = (16777216.0 * Baud * 4.0) / sysClk; reg [23:0] r_baudCnt = 0; reg [1:0] r_baudEdge = 0; always @(posedge i_clk ) begin r_baudCnt <= r_baudCnt + c_baudAddValue; r_baudEdge[1] = r_baudEdge[0]; r_baudEdge[0]= r_baudCnt[23]; o_baudTick <= 0; if (r_baudEdge[1] == 1'b0 && r_baudEdge[0] == 1'b1) begin o_baudTick <= 1'b1; end endendmodule
I just tried it, and it works as expected!I think Yosys uses the same trick to initialize registers to 1, as posted somewhere in Clifford/Claire's blog some time ago.