acelerando el vivado 2017.2

-1

Hola, estoy usando vivado 2017.2 y se necesita una cantidad infinita de tiempo para la síntesis, e incluso sospecho que el vivado está atascado porque no llego a ninguna parte. ¿Cómo puedo acelerar el proceso? ¿Qué configuraciones puedo cambiar para este propósito?

Estoy utilizando la placa FPGA Basys3 y la codificación en VHDL si esta información ayuda. Hice todo lo que pude pensar. Me deshice de los bucles y puse en cascada las declaraciones if que me dieron la funcionalidad de cronometrados para los bucles con la esperanza de que pudiera acelerar el proceso. Navegué por internet y no pude encontrar nada útil. La funcionalidad de este código es alta, pero se requiere que lo sea. Mi computadora no es vieja y funciona bien en términos de velocidad.

Y aquí está la parte del código que estoy escribiendo. Es simplemente un código para el procesamiento de algunas imágenes (cambio de contraste / brillo en un cuadrado pequeño que muevo en la imagen en la pantalla)

  type pixels is array (0 to PICTURE_WIDTH_HEIGHT - 1, 0 to 
  PICTURE_WIDTH_HEIGHT - 
  1) of std_logic_vector(11 downto 0);
  type RamType is array(0 to PICTURE_WIDTH_HEIGHT- 1) of bit_vector(11 downto 
  0);

 signal default_picture : pixels;
 signal processed_picture : pixels := default_picture;

 impure function InitRamFromFile (RamFileName : in string) return RamType is
 FILE RamFile : text is in RamFileName;
 variable RamFileLine : line;
 variable RAM : RamType;
 begin
 for I in RamType'range loop
 readline (RamFile, RamFileLine);
 read (RamFileLine, RAM(I));
 end loop;
 return RAM;
 end function;

 signal RAM : RamType := 
 InitRamFromFile("\ASUS\Users\AsusPc\Desktop\project_son\pictureData.data");

 begin

 with cursor_mode select length <=
 LENGTH_1 when "00",
 LENGTH_2 when "01",
 LENGTH_3 when "10",
 LENGTH_4 when "11";

  INITIALIZING_DEFAULT_PICTURE: process(default_clk) is
  variable ram_counter : integer range 0 to 62499 := 0;
  begin
  if rising_edge(default_clk) then
  for i in 0 to PICTURE_WIDTH_HEIGHT - 1 loop
  for j in 0 to PICTURE_WIDTH_HEIGHT - 1 loop
  default_picture(i,j) <= (to_stdlogicvector(RAM(ram_counter)));
  ram_counter := ram_counter + 1;
  end loop;
  end loop;
  end if;
  end process ;


  CLOCK_DIVIDER: process (default_clk, rst) begin
    if (rst = '1') then
    temporal <= '0';
    counter <= 0;             
   elsif rising_edge(default_clk) then
    if (counter = 1) then
        temporal <= NOT(temporal);
        counter <= 0;
    else
        counter <= counter + 1;
   end if;
   end if;
   end process;

   clk <= temporal;

   CNT_H : process (clk, rst) is
   begin  -- process CNT_H
   if rst = '1' then
   COUNTER_H <= 0;
   NEW_LINE  <= '0';
   elsif clk'event and clk = '1' then
   if (COUNTER_H = TOTAL_H-1) then
   COUNTER_H <= 0;
   NEW_LINE  <= '1';
   else
   COUNTER_H <= COUNTER_H + 1;
   NEW_LINE  <= '0';        
   end if;
   end if;
   end process CNT_H;

   CNT_V : process (clk, rst) is
   begin  -- process CNT_V
   if rst = '1' then
   COUNTER_V <= 0;
   elsif clk'event and clk = '1' then
   if (NEW_LINE = '1') then
   if (COUNTER_V = TOTAL_V-1) then
   COUNTER_V <= 0;          
   else
   COUNTER_V <= COUNTER_V + 1;
   end if;
   end if;
   end if;
   end process CNT_V;

   SYNC_H : process (clk, rst) is
   begin  -- process SYNC_H
   if rst = '1' then
   hs_out <= '0';
   elsif clk'event and clk = '1' then
   if (COUNTER_H < H_SYNC_TIME) then
   hs_out <= '0';
   else
   hs_out <= '1';
   end if;
   end if;
   end process SYNC_H;

   SYNC_V : process (clk, rst) is
   begin  -- process SYNC_V
   if rst = '1' then
   vs_out <= '0';
   elsif clk'event and clk = '1' then
   if (COUNTER_V < V_SYNC_TIME) then
   vs_out <= '0';
   else
   vs_out <= '1';
   end if;
   end if;
   end process SYNC_V;

   AREA_H : process (clk, rst) is
   begin  -- process AREA_H
   if rst = '1' then
   h_visible <= '0';
   elsif clk'event and clk = '1' then
   if (COUNTER_H > H_SYNC_TIME + H_BACK_PORCH - 1) and (COUNTER_H < TOTAL_H - 
   H_FRONT_PORCH) then
   h_visible <= '1';
   if ((COUNTER_H - (H_SYNC_TIME + H_BACK_PORCH)) <641) then
   pos_x <= COUNTER_H - (H_SYNC_TIME + H_BACK_PORCH);
   end if;
   else
   h_visible <= '0';
   end if;
   end if;
   end process AREA_H;

   AREA_V : process (clk, rst) is
   begin  -- process AREA_V
   if rst = '1' then
   v_visible <= '0';
   elsif clk'event and clk = '1' then
   if (COUNTER_V > V_SYNC_TIME + V_BACK_PORCH - 1) and (COUNTER_V < TOTAL_V - 
   V_FRONT_PORCH) then
   v_visible <= '1';
   if ((COUNTER_V - (V_SYNC_TIME + V_BACK_PORCH)) < 481) then
   pos_y     <= COUNTER_V - (V_SYNC_TIME + V_BACK_PORCH);
   end if;
   else
    v_visible <= '0';
    end if;
    end if;
    end process AREA_V;

    visible <= h_visible and v_visible;

    GOING_LEFT: process (go_left) is
    begin
    if go_left = '1' and (cursor_pos_x - length - 1 > 0) then
    cursor_pos_x <= cursor_pos_x - length  - 1;
    end if;
    if go_left = '1' and (cursor_pos_x - length  - 1 < 0) then
    cursor_pos_x <= 0;
    end if;            
    end process GOING_LEFT;

    GOING_RIGHT: process ( go_right) is
    begin
    if go_right = '1' and (cursor_pos_x + length  - 1 < PICTURE_WIDTH_HEIGHT)  
    then      
    cursor_pos_x <= cursor_pos_x + length  - 1;
    end if;
    if go_right = '1' and ( cursor_pos_x + length  - 1 > PICTURE_WIDTH_HEIGHT 
    - 1) 
    then
    cursor_pos_x <= 249;
    end if;
    end process GOING_RIGHT;

    GOING_UP: process (go_up) is
    begin
    if go_up = '1' and (cursor_pos_y - length  -1 > 0)  then      
    cursor_pos_y <= cursor_pos_y - length  - 1;
    end if;
    if go_up = '1' and ( cursor_pos_y - length  - 1 < 0) then
    cursor_pos_y <= 0;
    end if;
    end process GOING_UP;

    GOING_DOWN: process (go_down) is
    begin
    if go_down = '1' and (cursor_pos_y + length - 1 < PICTURE_WIDTH_HEIGHT)  
    then      
    cursor_pos_y <= cursor_pos_y + length  - 1;
    end if;
    if go_down = '1' and (cursor_pos_y + length  -1 > PICTURE_WIDTH_HEIGHT - 
    1) then
    cursor_pos_y <= 248 - length ;
    end if;
    end process GOING_DOWN;

    SHOW : process (clk, rst) is
    begin     
    if rst = '1' then

    processed_picture <= default_picture;
    cursor_pos_x <= 0;
    cursor_pos_y <= 0;

    elsif clk'event and clk = '1' then

    if (visible = '1') and ( pos_x < PICTURE_WIDTH_HEIGHT) and (pos_y 
    <PICTURE_WIDTH_HEIGHT) and (pos_x > -1) and (pos_y > -1) then

    if((pos_y = cursor_pos_y) and ((pos_x > cursor_pos_x -1) or (pos_x < 
    cursor_pos_x + length ))) or ((pos_y = cursor_pos_y + length -1) and 
    ((pos_x > cursor_pos_x -1) or (pos_x < cursor_pos_x + length))) then
            vgaData <= "000000000000";
            data_r <= vgaData(3*COLOR_BIT-1 downto 2*COLOR_BIT);
            data_g <= vgaData(2*COLOR_BIT-1 downto COLOR_BIT);
            data_b <= vgaData(COLOR_BIT-1 downto 0);       

    elsif ((pos_x = cursor_pos_x) and ((pos_y > cursor_pos_y - 1) or (pos_y < 
    cursor_pos_y + length))) or ((pos_x = cursor_pos_x + length -1) and 
    ((pos_y > 
    cursor_pos_y - 1) or (pos_y < cursor_pos_y + length))) then
            vgaData <= "000000000000";
            data_r <= vgaData(3*COLOR_BIT-1 downto 2*COLOR_BIT);
            data_g <= vgaData(2*COLOR_BIT-1 downto COLOR_BIT);
            data_b <= vgaData(COLOR_BIT-1 downto 0);
    else       
            vgaData <= processed_picture(pos_x,pos_y);
            data_r <= vgaData(3*COLOR_BIT-1 downto 2*COLOR_BIT);
            data_g <= vgaData(2*COLOR_BIT-1 downto COLOR_BIT);
            data_b <= vgaData(COLOR_BIT-1 downto 0);
    end if;
    if ((pos_x > PICTURE_WIDTH_HEIGHT - 1) and (pos_y > -1)) or ((pos_y > 
    PICTURE_WIDTH_HEIGHT - 1) and ((pos_x > -1) or (pos_x < 
    PICTURE_WIDTH_HEIGHT))) then
            vgaData <= "000000001111"; -- mavi
            data_r <= vgaData(3*COLOR_BIT-1 downto 2*COLOR_BIT);
            data_g <= vgaData(2*COLOR_BIT-1 downto COLOR_BIT);
            data_b <= vgaData(COLOR_BIT-1 downto 0);

   end if;
   end if;
   end if;

   end process SHOW;

   ADJUSTING_i_and_j: process(enable) is
   begin
   if(enable = '0') then
   i <= 0;
   j <= 0;
   end if;
   end process;

   ADJUSTING_cpx_and_cpy: process(length) is
   begin
   cursor_pos_x <= 0;
   cursor_pos_y <= 0;
   end process;


   BRIGHTNESS: process(enable, default_clk) is

   begin

   if enable = '1' then
   if operation = "00" then
   if rising_edge(default_clk) then

   if mode = '0' then --mode     

   if( i < PICTURE_WIDTH_HEIGHT) then --i
   if( j < PICTURE_WIDTH_HEIGHT) then --j

   if ( i > cursor_pos_x - 1) and (i < cursor_pos_x + length) and ( j > 
   cursor_pos_y - 1) and (j < cursor_pos_y + length) then -- condition

   if processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) < 14 then
   processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) <= 
   processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) + 2;
   end if;

   if processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) < 14 then
   processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) <= 
   processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) + 2;
   end if;

   if processed_picture(i,j)(COLOR_BIT-1 downto 0) < 14 then
   processed_picture(i,j)(COLOR_BIT-1 downto 0) <= processed_picture(i,j) 
   (COLOR_BIT-1 downto 0) + 2;
   end if;

   end if; --condition

   j <= j + 1;

   if( j = PICTURE_WIDTH_HEIGHT) then
   j <= 0;
   i <= i + 1;
   end if;

   end if; --j
   end if; --i

   end if; --mode  

   if mode = '1' then --mode

   if( i < PICTURE_WIDTH_HEIGHT) then --i
   if( j < PICTURE_WIDTH_HEIGHT) then --j

   if ( i > cursor_pos_x - 1) and (i < cursor_pos_x + length) and ( j > 
   cursor_pos_y - 1) and (j < cursor_pos_y + length) then --condition

   if processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) > 1 then
   processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) <= 
   processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) - 2;
   end if;

   if processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) > 1 then
   processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) <= 
   processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) - 2;
   end if;

   if processed_picture(i,j)(COLOR_BIT-1 downto 0) > 1 then
   processed_picture(i,j)(COLOR_BIT-1 downto 0) <= processed_picture(i,j) 
   (COLOR_BIT-1 downto 0) - 2;
   end if;

   end if; --condition

   j <= j + 1;

   if( j = PICTURE_WIDTH_HEIGHT) then
   j <= 0;
   i <= i + 1;
   end if;

   end if; --j

   end if; --i      

   end if; --mode

   end if; --enable
   end if; --operation
   end if; --clock

   end process BRIGHTNESS;

  CONTRAST: process(enable, default_clk) is
  begin
  if enable = '1' then
  if operation = "01" then
  if rising_edge(default_clk) then

  if mode = '0' then

  if( i < PICTURE_WIDTH_HEIGHT) then --i
  if( j < PICTURE_WIDTH_HEIGHT) then --j

  if ( i > cursor_pos_x - 1) and (i < cursor_pos_x + length) and ( j > 
  cursor_pos_y - 1) and (j < cursor_pos_y + length) then -- condition

  if  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) < 8 and 
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) > 1 then
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) <= 
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) - 2;
  end if;

  if processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) > 7 and 
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) < 14 then
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) <= 
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) +2 ;
  end if;

  if  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) < 8 and 
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) > 1 then
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) <= 
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) - 2;
  end if;

  if processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) > 7 and 
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) < 14 then
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) <= 
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) +2 ;
  end if;

  if  processed_picture(i,j)(COLOR_BIT-1 downto 0) < 8 and 
  processed_picture(i,j)(COLOR_BIT-1 downto 0) > 1 then
  processed_picture(i,j)(COLOR_BIT-1 downto 0) <= processed_picture(i,j) 
  (COLOR_BIT-1 downto 0) - 2;
  end if;

  if processed_picture(i,j)(COLOR_BIT-1 downto 0) > 7 and 
  processed_picture(i,j)(COLOR_BIT-1 downto 0) < 14 then
  processed_picture(i,j)(COLOR_BIT-1 downto 0) <= processed_picture(i,j) 
  (COLOR_BIT-1 downto 0) +2 ;
  end if;

  end if; --condition

  j <= j + 1;

  if( j = PICTURE_WIDTH_HEIGHT) then
  j <= 0;
  i <= i + 1;
  end if;

  end if; --j
  end if; --i

  end if; --mode

  if mode = '1' then

  if( i < PICTURE_WIDTH_HEIGHT) then --i
  if( j < PICTURE_WIDTH_HEIGHT) then --j

  if ( i > cursor_pos_x - 1) and (i < cursor_pos_x + length) and ( j > 
  cursor_pos_y - 1) and (j < cursor_pos_y + length) then --condition

  if  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) < 8 and 
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) > 2 then
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) <= 
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) - 3;
  end if;

  if processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) > 7 and 
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) < 13 then
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) <= 
  processed_picture(i,j)(3*COLOR_BIT-1 downto 2*COLOR_BIT) +3 ;
  end if;

  if  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) < 8 and 
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) > 2 then
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) <= 
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) - 3;
  end if;

  if processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) > 7 and 
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) < 13 then
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) <= 
  processed_picture(i,j)(2*COLOR_BIT-1 downto COLOR_BIT) +3 ;
  end if;

  if  processed_picture(i,j)(COLOR_BIT-1 downto 0) < 8 and 
  processed_picture(i,j)(COLOR_BIT-1 downto 0) > 2 then
  processed_picture(i,j)(COLOR_BIT-1 downto 0) <= processed_picture(i,j) 
  (COLOR_BIT-1 downto 0) - 3;
  end if;

  if processed_picture(i,j)(COLOR_BIT-1 downto 0) > 7 and 
  processed_picture(i,j)(COLOR_BIT-1 downto 0) < 13 then
  processed_picture(i,j)(COLOR_BIT-1 downto 0) <= processed_picture(i,j) 
 (COLOR_BIT-1 downto 0) + 3 ;
  end if;

  end if; --condition

  j <= j + 1;

  if( j = PICTURE_WIDTH_HEIGHT) then
  j <= 0;
  i <= i + 1;
  end if;

  end if; --j
  end if; --i

  end if; --mode

  end if; --clock
  end if; --operation
  end if; --enable

  end process CONTRAST;



  end VGA;
    
pregunta OnurTR

1 respuesta

2

Creo que estás subestimando enormemente la complejidad del código. Falta el valor importante de PICTURE_WIDTH_HEIGHT, pero del rango de ram_counter (0..62499) parece que está creando una instancia de aproximadamente 47,000,000,000 de flip-flops en este código.

Espero que este no sea el caso y que el rango de ram_counter sea simplemente incorrecto. Debe asegurarse de que todos sus datos puedan caber en un bloque de RAM, lo que no es el caso en este momento.

  for i in 0 to PICTURE_WIDTH_HEIGHT - 1 loop
  for j in 0 to PICTURE_WIDTH_HEIGHT - 1 loop
  default_picture(i,j) <= (to_stdlogicvector(RAM(ram_counter)));
  ram_counter := ram_counter + 1;
  end loop;
  end loop;

Lo que está haciendo aquí es esencialmente copiar una gran cantidad de datos dentro de un ciclo de reloj: esto significa que todos los Bits deben estar disponibles al mismo tiempo, lo que dificulta el almacenamiento en una RAM, pero requiere FF individual.

Recomiendo generar un bloque de RAM desde el generador de núcleo y usar esto en lugar de declarar enormes arreglos. De esta manera, se ve obligado a adherirse a la estructura interna de los bloques de RAM y, finalmente, puede alcanzar un estado con un consumo de recursos lo suficientemente bajo como para encaja en el FPGA.

    
respondido por el asdfex

Lea otras preguntas en las etiquetas