为什么我在clk_out上不关心?

发布于 2025-02-09 16:59:24 字数 522 浏览 1 评论 0原文

我将x作为 clk_out 。示例频率分隔线。

module freq_by2(input clk,rst,output reg clk_out);
  always @(posedge clk)
  begin
    if (rst==1'b1)
    begin
      clk_out<=0;
    end
    else
    begin
      clk_out<=~clk_out;
    end
  end
endmodule

module freq_by4(input clk,rst,output reg [1:0] clk_out);
  
  freq_by2 f0(.clk(clk),.rst(rst),.clk_out(clk_out[0]));
  freq_by2 f1(.clk(clk_out[0]),.rst(rst),.clk_out(clk_out[1]));
  
endmodule

I am getting X as clk_out.Example of the frequency divider.

module freq_by2(input clk,rst,output reg clk_out);
  always @(posedge clk)
  begin
    if (rst==1'b1)
    begin
      clk_out<=0;
    end
    else
    begin
      clk_out<=~clk_out;
    end
  end
endmodule

module freq_by4(input clk,rst,output reg [1:0] clk_out);
  
  freq_by2 f0(.clk(clk),.rst(rst),.clk_out(clk_out[0]));
  freq_by2 f1(.clk(clk_out[0]),.rst(rst),.clk_out(clk_out[1]));
  
endmodule

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

不交电费瞎发啥光 2025-02-16 16:59:24

确定,您正在生成正确的同步rst脉冲吗?也就是说,与clk和clk/2同步,因为您的f1实例化与clk_out输出f0的输出同步?否则,您将否定clk_out freq_by2 内的最后一个值,该值最初是x,除非生成正确的重置。

Are you sure, you are generating a correct, synchronous rst pulse? That is, synchronous to both clk and clk/2, because your f1 instantiation is synchronous to the clk_out output of f0? Otherwise, you are negating the last value of clk_out inside of freq_by2, which is X initially, unless a correct reset was generated.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文