"How to resolve 'unconnected port' and 'unused sequential element' warnings in Vivado synthesis for I2S Top module?

huangapple go评论90阅读模式
英文:

"How to resolve 'unconnected port' and 'unused sequential element' warnings in Vivado synthesis for I2S Top module?

问题

当在Vivado中合成上述代码时,出现以下警告。

[Synth 8-3332] 顺序元件 (\i2s_rx/rx_right_reg[15] ) 未使用,将从模块i2s_top中删除。

[Synth 8-3331] 设计i2s_top具有未连接的端口i_tx_left_chan[15]。
.
.
.
[Synth 8-3331] 设计i2s_top具有未连接的端口i_tx_left_chan[0]。

[Synth 8-3331] 设计i2s_top具有未连接的端口i_tx_right_chan[15]。
.
.
.
[Synth 8-3331] 设计i2s_top具有未连接的端口i_tx_right_chan[0]。

如何解决呢?

此外,我正在学习SOC RTL,并且必须进行综合,但我没有单独说lib。那么,我可以只用Vivado进行综合吗?我应该使用任何现有的lib作为设计编译器进行综合吗?

英文:

When synthesizing the above code in vivado, the following warning appears.

[Synth 8-3332] Sequential element (\i2s_rx/rx_right_reg[15] ) is unused and will be removed from module i2s_top.

[Synth 8-3331] design i2s_top has unconnected port i_tx_left_chan[15]
.
.
.
[Synth 8-3331] design i2s_top has unconnected port i_tx_left_chan[0]

[Synth 8-3331] design i2s_top has unconnected port i_tx_right_chan[15]
.
.
.
[Synth 8-3331] design i2s_top has unconnected port i_tx_right_chan[0]

How should I solve it?

Also, I am studying SOC RTL and I have to do synthesis, but I didn't say lib separately. Then, can I just do vivado synthesis? Should I do synthesis with any existing lib as a design compiler?

module i2s_top #(
    parameter AUDIO_DW = 16
)(
    input i_tx_sclk,
    input i_rst_n,
    input [AUDIO_DW-1:0] i_tx_prescaler,
    input [AUDIO_DW-1:0] i_tx_left_chan,
    input [AUDIO_DW-1:0] i_tx_right_chan,

    output [AUDIO_DW-1:0] o_rx_left_chan,
    output [AUDIO_DW-1:0] o_rx_right_chan
);

wire w_sclk;
wire w_lrclk;
wire w_sdata;

i2s_tx #(
    .AUDIO_DW(AUDIO_DW)
) i2s_tx (
    .i_tx_sclk(i_tx_sclk),
    .i_tx_rst_n(i_rst_n),
    .i_tx_prescaler(i_tx_prescaler),
    
    .o_tx_sclk(w_sclk),
    .o_tx_lrclk(w_lrclk),
    .o_tx_sdata(w_sdata),
    
    .i_tx_left_chan(i_tx_left_chan),
    .i_tx_right_chan(i_tx_right_chan)
);

i2s_rx #(
    .AUDIO_DW(AUDIO_DW)
) i2s_rx (
    .i_rx_sclk(w_sclk),
    .i_rx_rst_n(i_rst_n),
    .i_rx_lrclk(w_lrclk),
    .i_rx_sdata(w_sdata),
    .o_rx_left_chan(o_rx_left_chan),
    .o_rx_right_chan(o_rx_right_chan)
);

endmodule

module i2s_tx #(
    parameter AUDIO_DW = 16
)(
    input i_tx_sclk,
    input [AUDIO_DW-1:0] i_tx_prescaler,
    input i_tx_rst_n,
    
    output wire o_tx_sclk,
    output reg o_tx_lrclk = 0,
    output reg o_tx_sdata = 0,

    input [AUDIO_DW-1:0] i_tx_left_chan,
    input [AUDIO_DW-1:0] i_tx_right_chan
);

reg [AUDIO_DW-1:0] tx_bit_cnt = 1;
reg [AUDIO_DW-1:0] tx_left = 0;
reg [AUDIO_DW-1:0] tx_right = 0;

assign o_tx_sclk = i_tx_sclk;

always @(negedge i_tx_sclk or negedge i_tx_rst_n) begin
    if (!i_tx_rst_n) begin
        tx_bit_cnt = 1;
    end else if (tx_bit_cnt >= i_tx_prescaler) begin
        tx_bit_cnt <= 1;
    end else begin
        tx_bit_cnt <= tx_bit_cnt + 1;
    end

    if (!i_tx_rst_n) begin
        tx_left = 0;
        tx_right = 0;
    end else if (tx_bit_cnt == i_tx_prescaler && o_tx_lrclk) begin
        tx_left <= i_tx_left_chan;
        tx_right <= i_tx_right_chan;
    end
                
    o_tx_lrclk <= (tx_bit_cnt == i_tx_prescaler) ? ~o_tx_lrclk : o_tx_lrclk;
    
    o_tx_sdata <= o_tx_lrclk ? tx_right[AUDIO_DW - tx_bit_cnt] : tx_left[AUDIO_DW - tx_bit_cnt];
    
end

endmodule
module i2s_rx #(
    parameter AUDIO_DW = 16
)(
    input i_rx_sclk,
    input i_rx_rst_n,
    input i_rx_lrclk,
    input i_rx_sdata,

    output reg [AUDIO_DW-1:0] o_rx_left_chan = 0,
    output reg [AUDIO_DW-1:0] o_rx_right_chan = 0
);

reg [AUDIO_DW-1:0] rx_left = 0;
reg [AUDIO_DW-1:0] rx_right = 0;
reg rx_lrclk_r = 0;
wire rx_lrclk_nedge;

assign rx_lrclk_nedge = !i_rx_lrclk & rx_lrclk_r;

always @(posedge i_rx_sclk or negedge i_rx_rst_n)
        if (!i_rx_rst_n)
                rx_lrclk_r <= 0;
        else
                rx_lrclk_r <= i_rx_lrclk;

always @(posedge i_rx_sclk or negedge i_rx_rst_n)
        if (!i_rx_rst_n) begin
                rx_right <= 0;
                rx_left <= 0;
        end else if (rx_lrclk_r) begin
                rx_right <= {rx_right[AUDIO_DW-2:0], i_rx_sdata};
        end else 
                rx_left <= {rx_left[AUDIO_DW-2:0], i_rx_sdata};

always @(posedge i_rx_sclk or negedge i_rx_rst_n)
        if (!i_rx_rst_n) begin
                o_rx_left_chan <= 0;
                o_rx_right_chan <= 0;
        end else if (rx_lrclk_nedge) begin
                o_rx_left_chan <= rx_left;
                o_rx_right_chan <= {rx_right[AUDIO_DW-2:0], i_rx_sdata};
end

endmodule

synthesis Schematic
enter image description here

RTL Schematic
enter image description here

答案1

得分: 0

为解决“未连接端口”警告,请确保模块的所有端口都连接到某个信号。在您的I2S顶层模块中,以下端口未连接到任何信号:

  • i_rst_n
  • w_sclk
  • w_lrclk
  • w_sdata

确保将这些端口连接到某个信号,可以是内部的也可以是外部的。

要解决“未使用的时序元素”警告,可以尝试优化设计。此警告通常表示设计中存在未使用的寄存器,可能会增加资源利用率和时序复杂性。您可以尝试删除或优化这些寄存器以改善设计。

关于您关于库的问题,Vivado综合使用Xilinx提供的默认库。但是,如果您有自己带有自定义单元的库,可以在Vivado中通过将其添加到库搜索路径来指定。要添加自定义库,请转到项目设置 > Verilog HDL综合 > 库,并添加您库的路径。如果您的代码中没有定义任何自定义单元,您无需担心这个问题,可以直接使用默认库。

英文:

To resolve the "unconnected port" warning, you need to make sure that all the ports of your modules are connected to some signal. In your I2S top module, the following ports are not connected to any signal:

  • i_rst_n
  • w_sclk
  • w_lrclk
  • w_sdata

Make sure that you connect these ports to some signal, either internally or externally.

To resolve the "unused sequential element" warning, you can try optimizing your design. This warning typically indicates that there are registers that are not being used in your design, which can increase the resource utilization and timing complexity. You can try removing or optimizing these registers to improve your design.

Regarding your question about the library, Vivado synthesis uses the default library provided by Xilinx. However, if you have your own library with custom cells, you can specify it in Vivado by adding it to the library search path. To add a custom library, go to Project Settings > Verilog HDL Synthesis > Libraries and add the path to your library. If you didn't define any custom cells in your code, you don't need to worry about this and you can just use the default library.

huangapple
  • 本文由 发表于 2023年3月9日 13:10:29
  • 转载请务必保留本文链接:https://go.coder-hub.com/75680647.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定