2016-05-12 90 views
1

我有问题使用submod命令分区我的顶级模块。如何使用submod命令将顶层模块划分为2个子模块?

我有一个简单的计数器(我有一个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 

我不知道如何使用selectsetattrsubmod这样做。任何帮助是极大的赞赏。

谢谢


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 

回答

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 

请让我知道是否有更好的方法。 谢谢

+1

看起来不错。如果您想避免枚举所有对象,请参阅'help select'以获取更复杂的选择对象的方法。 – CliffordVienna