【问题标题】:How to partition a top module into 2 sub-module using submod command?如何使用 submod 命令将顶部模块划分为 2 个子模块?
【发布时间】:2016-05-12 15:53:02
【问题描述】:

我在使用 submod 命令对我的顶层模块进行分区时遇到问题。

我有一个简单的计数器(我有一个 4 位计数器的行为代码)。其中包含以下单元格:

yosys> select -list
counter
counter/$procmux$4_Y
counter/$add$counter.v:10$2_Y
counter/$0\count[3:0]
counter/count
counter/en
counter/rst
counter/clk
counter/$procdff$9
counter/$procmux$7
counter/$procmux$4
counter/$add$counter.v:10$2

现在我想将以下单元格放入一个子模块中:

counter/$procdff$9
counter/$procmux$7

我不知道如何使用select、setattr、submod 来做到这一点。非常感谢任何帮助。

谢谢


我的计数器的verilog代码:

module module counter (clk, rst, en, count);
input clk, rst, en;
output reg [3:0] count;   
always @(posedge clk)
  if (rst)
     count <= 4'd0;
  else if (en)
     count <= count + 4'd1;
endmodule

【问题讨论】:

    标签: yosys


    【解决方案1】:

    我想通了:

    首先我选择单元格,然后将它们放入我想要的分区中:

    yosys> select counter/$procmux$4
    yosys*> select -add counter/$procmux$7
    yosys*> select -add counter/$add$counter.v:10$2
    yosys*> submod -name sub_2
    
    yosys> select counter/$procmux$4_Y
    yosys*> select -add counter/$add$counter.v:10$2_Y
    yosys*> select -add counter/$0\count[3:0]
    yosys*> select -add counter/count
    yosys*> select -add counter/$procdff$9
    submod -name sub_1
    

    如果有更好的方法,请告诉我。 谢谢

    【讨论】:

    • 我觉得不错。如果您想避免枚举所有对象,请参阅help select 了解更复杂的选择对象的方法。
    猜你喜欢
    • 2021-03-09
    • 2021-01-23
    • 2012-01-25
    • 1970-01-01
    • 2012-01-06
    • 2018-01-20
    • 1970-01-01
    • 2018-03-13
    • 1970-01-01
    相关资源
    最近更新 更多