[問題] veriog撰寫問題

看板Electronics作者 (adol)時間16年前 (2009/08/05 20:47), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/10 (看更多)
module add_sub(clk,reset,mod_n,incr,decr); input clk,incr,decr,reset; output[12:0] mod_n; reg [1:0] state,next_state; reg [12:0] mod_n; parameter s0=2'd0,s1=2'd1,s2=2'd2,s3=2'd3; always@(posedge clk) begin if(reset) state=s0; else state=next_state; end //s0:重置用 s1:增加mod_n s2:減少mod_n s3:維持mod_n always@(state) begin case(state) s0:mod_n=13'd2000; s1:mod_n=mod_n+13'd10; s2:mod_n=mod_n-13'd10; default:; endcase end //當incr變為high時增加mod_n //當decr變為high時減少mod_n always@(state or incr or decr) begin case(state) s0: next_state=s3; s1: if(decr) next_state=s1; else next_state=s3; s2: if(incr) next_state=s2; else next_state=s3; s3: if(incr) next_state=s2; else if(decr) next_state=s1; else next_state=s3; default: next_state=s0; endcase end endmodule 上面是我寫的verilog 程式碼 目的是把mod_n傳到除頻器當除頻參數 所以藉由控制mod_n可以決定除頻後的頻率 我目前的問題是 使用quartus II燒錄至FPGA後 電路的動作完全錯誤 和我所撰寫的完全不同 想問版上的高手 我的code是不是有容易被合成軟體誤解的地方 我已經改了很多次還是一樣 麻煩好心的高手指點一下 謝謝 我把compile之後的warning訊息貼上來 Warning: Found 1 node(s) in clock paths which may be acting as ripple and/or gated clocks -- node(s) analyzed as buffer(s) resulting in clock skew Warning: Circuit may not operate. Detected 23 non-operational path(s) clocked by clock "clk" with clock skew larger than data delay. ※ 編輯: felghana 來自: 58.114.132.207 (08/06 10:45)
文章代碼(AID): #1AUNztxR (Electronics)
討論串 (同標題文章)
文章代碼(AID): #1AUNztxR (Electronics)