【问题标题】:verilog code is working in isim(xilinx 14.2) but is not working onspartan6verilog 代码在 isim(xilinx 14.2) 中工作,但在 onspartan6 上不工作
【发布时间】:2018-12-07 16:57:27
【问题描述】:

我在 verilog (xilix 14.2) 中编写了一个简单的计数器代码。该代码在 isim 中正常工作,但我无法将其转储到 spartan6 上。当我尝试转储代码时,spartan 6 上的红灯亮起,并且代码未转储。请让我知道我需要做的改变。

module clk(int_clk,ext_pulse,reset,pos_count,neg_count);
input int_clk;
input ext_pulse;
input reset;
output reg [7:0] pos_count;
output reg [7:0] neg_count;
reg [7:0] count;
always@(posedge int_clk)
if(reset)
begin
pos_count<=0;
neg_count<=0;
end
else if(ext_pulse)
begin
neg_count<=neg_count+1;
pos_count<=0;
end
else
begin
pos_count<=pos_count+1;
neg_count<=0;
end
endmodule

【问题讨论】:

    标签: verilog fpga xilinx-ise spartan


    【解决方案1】:

    嘿,你还没有在 always 块中添加 begin..end。此外,您使用了通常不建议使用的同步重置。我对您的代码进行了一些更改。顺便说一句,您是生成比特流的吗?

    module clk(int_clk,ext_pulse,reset,pos_count,neg_count);
    input int_clk;
    input ext_pulse;
    input reset;
    
    output reg [7:0] pos_count;
    output reg [7:0] neg_count;
    reg [7:0] count;              //This reg is unused
    
    always@(posedge int_clk or posedge reset) //I am assuming you want active high reset
    begin
    if(reset)
    begin
      pos_count<=0;
      neg_count<=0;
    end
    else if(ext_pulse)
    begin
     neg_count<=neg_count+1;
     pos_count<=0;
    end
    else
    begin
     pos_count<=pos_count+1;
     neg_count<=0;
    end
    end
    endmodule
    

    【讨论】:

      猜你喜欢
      • 2012-12-01
      • 2015-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-22
      • 1970-01-01
      • 1970-01-01
      • 2016-03-10
      相关资源
      最近更新 更多