我正在學習Verilog和使用CPLD,我卡住了。我寫的代碼切換LED,但在合成過程中不斷收到警告。萊迪思鑽石:設置時鐘
//toggles LED on and off after 1000000 clock cycles
module LEDON(
LED,
clk
);
output LED;
reg LED;
input clk ;
wire clk;
reg [31:0] count;
wire count_max = 32'd1_000_000;
assign count_nxt = (count >= count_max) ? 32'd0 : count + 32'd1;
assign led_state_nxt = (count == count_max) ? ~LED : LED;
always @(posedge clk)
begin
count <= count_nxt;
LED <= led_state_nxt;
end
endmodule
我得到這些警告:
@W:MT420 |找到推斷時鐘LEDON | CLK週期爲1000.00ns。警告 - 地圖:C:/ Documents and Settings/belo/Desktop/LedOn2/LedON2.lpf(4):頻率網絡中的錯誤「clk」2.080000 MHz;
警告 - 映射:偏好分析結果:檢測到1個語義錯誤
警告 - 映射:首選項文件「C:/ Documents and Settings/belo/Desktop/LedOn2/LedON2.lpf」中存在錯誤。
警告 - 映射:首選項文件「C:/ Documents and Settings/belo/Desktop/LedOn2/LedON2.prf」中存在語義錯誤。
我的LPF文件看起來像這樣:
BLOCK RESETPATHS ;
BLOCK ASYNCPATHS ;
LOCATE COMP "LED" SITE "41" ;
FREQUENCY NET "clk" 2.08 MHz ;
因此,沒有人知道如何解決這些時鐘警告?
我試圖通過更改我的LPF文件中的代碼來修復大部分警告:FREQUENCY NET「clk」2.08 MHz;到頻率端口「clk」2.08 MHz; 但LED仍不閃爍。 –
現在的錯誤: @W:CL189:「C:\ Documents and Settings \ belo \ Desktop \ LedOn2 \ LEDON.v」:20:0:20:5 |寄存器位數[2]始終爲0,優化。 .. @W:CL189:「C:\ Documents and Settings \ belo \ Desktop \ LedOn2 \ LEDON.v」:20:0:20:5 |寄存器位計數[1]始終爲0,正在優化.. @W:CL189:「C:\ Documents and Settings \ belo \ Desktop \ LedOn2 \ LEDON。v「:20:0:20:5 |寄存器位數[0]始終爲0,優化... @W:MT420 |發現推斷時鐘LEDON |時鐘週期爲1000.00ns。請聲明用戶定義時鐘上的物體「p:clk」 –
你模擬過這個嗎? – 2012-07-02 21:09:19