2016-05-12 86 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