Vivado está eliminando los registros que se utilizarán

3

Estoy trabajando en un programa Verilog en el que quiero que muestre algún tipo de forma de onda de audio (capturada desde mi micrófono) a través de un VGA. Utilizo el siguiente módulo para cambiar las nuevas muestras de audio y lo intercambio con el búfer utilizado para almacenar los valores para el fotograma actual que representa el controlador vga.

module audio_shift_buffer#
(parameter BUFFER_SIZE = 1280)
(
    input vga_clk,
    input smp_clk,
    input [7:0] sample_in,
    input  sample_in_valid,
    input [10:0] vga_read_index,
    output reg [7:0] vga_read_out,
    input vga_swap_buffers
);

    reg [7:0] smp_buf[BUFFER_SIZE - 1:0];
    reg [7:0] vga_buf[BUFFER_SIZE - 1:0];

    integer i;
    always @(posedge smp_clk) 
        if(sample_in_valid) begin
            for(i = 0; i < BUFFER_SIZE - 1; i = i + 1)
                smp_buf[i] <= smp_buf[i + 1];
            smp_buf[BUFFER_SIZE - 1] <= sample_in;
        end

    integer j;
    always @(posedge vga_clk) begin
        if(vga_swap_buffers)
            for(j = 0; j < BUFFER_SIZE; j = j + 1)
                vga_buf[j] <= smp_buf[j];
        vga_read_out <= vga_buf[vga_read_index];
    end

endmodule

Este módulo se crea dentro de mi visualizador de audio de nivel superior junto con el vga_controller.

module audio_visualizer
(
    input clk,
    input m_data,
    output m_clk,
    output reg m_lr = 1'b1,
    output vga_hs, vga_vs,
    output [3:0] vga_r, vga_g, vga_b,
    input sw
);

    wire vga_clk;
    wire [10:0] sound_level_index;
    clk_wiz_0 cwz(clk, vga_clk);
    wire [7:0] vga_read;
    wire swap;

    audio_shift_buffer sb
    (
        .vga_clk(vga_clk),
        .smp_clk(vga_clk),
        .sample_in({8{sw}}),
        .sample_in_valid(swap),
        .vga_read_index(sound_level_index),
        .vga_read_out(vga_read),
        .vga_swap_buffers(swap)
    );

    vga_controller v
    (
        .vga_clk(vga_clk),
        .hsync(vga_hs),
        .vsync(vga_vs),
        .r(vga_r),
        .g(vga_g),
        .b(vga_b),
        .sound_level_index(sound_level_index),
        .sound_level(vga_read),
        .swap_buffers(swap)
    );

endmodule

Finalmente aquí está mi controlador VGA.

module vga_controller#
(
    parameter H_VISIBLE = 1280,
    parameter H_FRONT_PORCH = 72,
    parameter H_BACK_PORCH = 216,
    parameter H_SYNC = 80,
    parameter V_VISIBLE = 720,
    parameter V_FRONT_PORCH = 3,
    parameter V_BACK_PORCH = 22,
    parameter V_SYNC = 5
)
(
    input vga_clk,
    output [3:0] r, g, b,
    output reg hsync, vsync,
    output [10:0] sound_level_index,
    input [7:0] sound_level,
    output reg swap_buffers
);

    localparam H_RES = H_VISIBLE + H_FRONT_PORCH + H_BACK_PORCH + H_SYNC;
    localparam V_RES = V_VISIBLE + V_FRONT_PORCH + V_BACK_PORCH + V_SYNC;

    localparam H_IN_VIDEO = H_VISIBLE;
    localparam H_IN_BP = H_IN_VIDEO + H_BACK_PORCH;
    localparam H_IN_SYNC = H_IN_BP + H_SYNC;
    localparam H_IN_FP = H_IN_SYNC + H_FRONT_PORCH;

    localparam V_IN_VIDEO = V_VISIBLE;
    localparam V_IN_BP = V_IN_VIDEO + V_BACK_PORCH;
    localparam V_IN_SYNC = V_IN_BP + V_SYNC;
    localparam V_IN_FP = V_IN_SYNC + V_FRONT_PORCH;

    reg [10:0] x = 0, y = 0, next_x, next_y;
    always @(posedge vga_clk) begin
        x <= next_x;
        y <= next_y;
    end

    always @* begin
        next_y = y;
        if(x == H_RES - 1) begin
            next_x <= 0;
            if(y == V_RES - 1)
                next_y <= 0;
            else
                next_y <= y + 1;
        end else
            next_x <= x + 1;
    end

    always @(posedge vga_clk) begin
        hsync <= ~(next_x >= H_IN_BP && next_x < H_IN_SYNC);
        vsync <= ~(next_y >= V_IN_BP && next_y < V_IN_SYNC);
        swap_buffers <= next_y == V_IN_VIDEO && next_x == 0;
    end

    reg vout_enable;
    always @(posedge vga_clk) begin
        vout_enable <= next_x < H_IN_VIDEO && next_y < V_IN_VIDEO;
    end

    wire [10:0] request_x = next_x + 1;
    assign sound_level_index = request_x < H_IN_VIDEO ? request_x : 0;

    wire [10:0] ubound = 11'd360 + sound_level;
    wire [10:0] lbound = 11'd360 - sound_level;
    reg color;
    always @(posedge vga_clk) begin
        color <= next_y <= ubound && next_y >= lbound;
    end

    assign r = {4{color & vout_enable}};
    assign g = {4{color & vout_enable}};
    assign b = {4{color & vout_enable}};
endmodule

Ahora mismo simplemente lo tengo conectado a un interruptor en mi tablero. Agrega una "muestra" del interruptor después de cada fotograma. Cuando lo probé todo parece funcionar perfectamente. Las barras blancas se desplazan por la pantalla cuando el interruptor está encendido y, de lo contrario, se ven negras. Sin embargo, recibo las siguientes advertencias de síntesis que no tienen ningún sentido para mí. Los elementos que está listando están siendo claramente utilizados. Si no lo fueran, entonces dudo que el programa funcione. Incluso indica que vga_read_out no está en uso, lo que no puede ser cierto, ya que es la única forma en que el controlador puede obtener datos y mostrar el resultado correcto. ¿Qué está pasando aquí?

[Synth 8-3332] Sequential element (\smp_buf_reg[1279][5] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1279][4] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1279][3] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1279][2] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1279][1] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1279][0] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[0][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[0][5] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[0][4] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[0][3] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[0][2] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[0][1] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[0][0] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_read_out_reg[7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_read_out_reg[5] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_read_out_reg[4] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_read_out_reg[3] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_read_out_reg[2] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_read_out_reg[1] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_read_out_reg[0] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1279][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1278][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1278][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1277][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1277][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1276][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1276][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1275][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1275][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1274][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1274][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1273][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1273][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1272][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1272][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1271][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1271][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1270][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1270][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1269][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1269][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1268][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1268][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1267][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1267][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1266][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1266][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1265][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1265][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1264][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1264][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1263][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1263][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1262][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1262][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1261][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1261][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1260][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1260][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1259][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1259][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1258][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1258][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1257][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1257][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1256][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1256][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1255][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1255][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1254][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1254][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1253][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1253][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1252][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1252][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1251][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1251][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1250][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1250][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1249][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1249][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1248][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1248][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1247][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1247][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1246][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1246][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1245][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1245][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1244][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1244][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1243][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1243][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1242][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1242][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1241][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1241][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\smp_buf_reg[1240][7] ) is unused and will be removed from module audio_shift_buffer.
[Synth 8-3332] Sequential element (\vga_buf_reg[1240][7] ) is unused and will be removed from module audio_shift_buffer.
    
pregunta chasep255

1 respuesta

10

Si los está eliminando, en realidad no se utilizan, pero no siempre es obvio por qué.

Creo que en tu caso, la razón es:

.sample_in({8{sw}}),

El sintetizador es lo suficientemente inteligente como para darse cuenta de que los bits en cada palabra de sus memorias ( smp_buf y vga_buf ) son idénticos. Como resultado, decide que no tiene sentido duplicar el hardware, también podría tener una versión de 1 bit de ancho.

Dondequiera que se usó la palabra de 8 bits de ancho, simplemente llena los 8 bits con el valor de la nueva palabra de 1 bit de ancho. Esto produce el mismo comportamiento pero con menos lógica.

    
respondido por el Tom Carpenter

Lea otras preguntas en las etiquetas