How can you determine the amount of flip flops that will be generated during synthesis without using any tool?
This first code is supposed to create 5 flip flops
module regdesp (PL, RST, ENSERIE, CLOCK, ENPARA, SALSERIE);
input PL;
input RST;
input ENSERIE;
input CLOCK;
input[3:0] ENPARA;
output SALSERIE;
logic SALSERIE;
logic [3:0] SHIFT;
always_ff @(posedge CLOCK or negedge RST)
if (!RST)
SHIFT <= 4'b0000 ;
else
if (!PL)
SHIFT <= ENPARA ;
else
begin
SHIFT[3] <= ENSERIE ;
begin : xhdl_0
integer i;
for(i = 2; i >= 0; i = i - 1)
begin : DESPLAZAR
SHIFT[i] <= SHIFT[i + 1] ;
end
end
SALSERIE=SHIFT[0];
end
endmodule
This second example creates 32 flip flops
module SHIFTER2D(clock,reset,clear,shift,entrada_serie, salida_serie);
parameter tamanyo=4;
input clock;
input reset;
input [7:0] entrada_serie;
input clear;
input shift;
output [7:0] salida_serie ;
logic [tamanyo-1:0][7:0] aux;
always_ff @(posedge clock or negedge reset)
if (!reset)
aux<={tamanyo{8'b0}};
else
if (!clear)
if (shift==1'b1)
aux<={entrada_serie,aux[tamanyo-1:1]};
else
begin
aux[tamaƱo-1]<= entrada_serie;
aux<={tamanyo{8'b0}};
end
assign salida_serie=aux[0];
endmodule
I want to understand how can you tell from the code that 5 and 32 flip flops will be generated when the code is synthesized.