作者amistad (amistad)
标题Re: [请益] Verilog module reset写法 2
时间Sat Dec 3 16:19:40 2016
state4.m 为什麽用non-block assignment ??
如果是要用ISE ,他有一些verilog template 可以套。
建议套用ISE 的template,确保 ISE tool 合成你要的元件。
code 是要写给 ISE 看,如果 ISE 看不懂,那合出什麽东西就
不知道。
※ 引述《nc23nick (弄牛连)》之铭言:
: 延续之前小弟在版上发问的问题,how to reset counter in state of FSM ?
: 小弟在top module 里新增一条讯号线clear来reset state里的counter
: 现在问题来了modelsim output waveform一切正常,但用ise烧fpga
: 吐出的波形在第一次clear触发後讯号就都错出(疑是control没有被reset)
: 想请问大大小弟下面的写法是否有误?
: top.m
: ===================================================================
: always @(posedge clk or negedge rst) begin // reset control of unit
: if (~rst) begin
: clear <= 0;
: end
: else if (curr_state == S4 && counter == 10'd127 ||
: curr_state == S5 && counter == 10'd236 || ) begin
: clear <= 1;
: end
: else begin
: clear <= 0;
: end
: end
: ===================================================================
: state4.m
: ===================================================================
: always @(posedge clk or negedge rst) begin
: if(~rst) begin
: control= 1;
: set = 0;
: end
: else begin
: if(set == 0) begin
: control = 0;
: set = 1;
: end
: else
: control = (clear == 1) ? 0 : control + 1;
: end
: end
: ===================================================================
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 27.105.243.190
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Electronics/M.1480753182.A.230.html
1F:推 yunnlai: 正好跑 Xilinx ISE 软体, 顺便贴网友说的 template: 12/04 21:40
3F:推 mmonkeyboyy: 这年头别再用ISE了 除非你还是用旧的硬体 12/07 20:29