Forum: FPGA, VHDL & Co. Code optimierung


von auba (Gast)


Lesenswert?

Hallo miteinander

ich versuche schon eine Zeit lang meinen Code auf meinem FPGA 
unterzubringen jedoch erfolglos

bis jetzt schaff ich es nur mit einer Version die als Bitwidth =128 
eingestellt hat

alles darüber kann er nicht routen und mappen

es handelt sich dabei um einen modularen Multiplizierer für große Zahlen
(state1*state2 mod modul_i)

hier ein teil des relevanten codes
1
p_modmult: process(s_clk)  --Blakleys Methode
2
  variable s_between : unsigned ((3*bitwidth -3) downto 0) :=(OTHERS =>'0');
3
  begin
4
if rising_edge(s_clk) then
5
if s_rst='1' then
6
 s_between:= (OTHERS =>'0');
7
 s_busy<='0';
8
else  
9
 if s_busy='0' and s_ld='1' then --load
10
   s_busy<='1';
11
   s_between:= (OTHERS =>'0');
12
   act_count<=0;
13
   s_state1 <= state1_i;  --sidechannel HERE
14
   s_state2 <= UNSIGNED(state2_i);
15
   s_modul <= UNSIGNED(modul_i) ;
16
 elsif s_busy='1' then        
17
   --y*2 + a_k-1-i*b
18
   s_between:=s_between sll 1;
19
   if s_state1(bitwidth-1-act_count)='1' then  -- = a_{k-1-i}
20
      s_between := s_between +s_state2;
21
   end if;
22
   if s_between  >=s_modul then
23
     s_between:=s_between-s_modul;  --Restbildung 1
24
   end if;
25
   if s_between  >= s_modul then
26
     s_between:=s_between-s_modul;  --Restbildung 1
27
   end if;
28
   if act_count=bitwidth -1 then
29
     s_busy<='0';
30
     s_state_o<=std_logic_vector(s_between((bitwidth -1 ) downto 0)); --Final Solution a*b
31
   else
32
      act_count<=act_count+1;
33
   end if;
34
 end if;
35
end if;
36
end if;
37
end process;

ich verwende ein spartan 6 development board
kann ich das vielleicht Schieberegister ohne Flipflops realisieren?

Meine Fehlermeldung für bitwidth=256:
Route:471 -
   This design is unrouteable. Router will not continue. To evaluate the 
problem please use fpga_editor. The nets listed
   below can not be routed:
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<252>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<264>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<272>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<276>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<292>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<312>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<320>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<324>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<364>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<412>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<416>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<420>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<428>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<464>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<468>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<472>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<612>
Unrouteable 
Net:i_decrypt/i_modexp/i_modmult/Madd_p_modmult.s_between[764]_GND_11_o_ 
add_3_OUT_cy<644>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<252>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<260>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<264>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<268>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<296>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<300>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<304>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<324>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<328>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<340>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<344>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<348>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<672>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<728>
Unrouteable 
Net:i_decrypt/i_modexp/i_modsquare/Madd_p_modmult.s_between[764]_GND_12_ 
o_add_3_OUT_cy<744>


Hier mein Report aus der ISE:
         Used  Available   Utilization
Number of Slice LUTs
          6,072   27,288   22%  (werden fast alle als logic verwendet)

Number of occupied Slices
        1,826    6,822     26%

Number of MUXCYs used
          2,856   13,644    20%


Number of fully used LUT-FF pairs
       2,318     6,383       36%



Number of LUT Flip Flop pairs used
       6,383

  Number with an unused Flip Flop
       3,754   6,383      58%


DANKE
lukas

von Lothar M. (Firma: Titel) (lkmiller) (Moderator) Benutzerseite


Lesenswert?

auba schrieb:
> hier ein teil des relevanten codes
>    s_between:=s_between sll 1;
Eine speichernde Variable. Das ist eine ganz üble Idee. Hier macht es 
noch nichts aus, aber um eine speichernde Variable einsetzen zu dürfen, 
musst du eigentlich sagen, warum es hier nichts ausmacht. Sonst 
solltest du sie nicht verwenden.

> unrouteable
Diese Berechnung hier wird unmittelbar hintereinander verdrahtet:
1
   s_between:=s_between sll 1;
2
   if s_state1(bitwidth-1-act_count)='1' then  -- = a_{k-1-i}
3
      s_between := s_between +s_state2;
4
   end if;
5
   if s_between  >=s_modul then
6
     s_between:=s_between-s_modul;  --Restbildung 1
7
   end if;
8
   if s_between  >= s_modul then
9
     s_between:=s_between-s_modul;  --Restbildung 1
10
   end if;
Also alle Addierer, Vergleicher und Subtrahierer. Das ist ein 
gigantischer Verdrahtungsaufwand, den der Router nicht mehr packt...
Musst du da in jedem Takt alle diese Rechenschritte machen?

> auf meinem FPGA
Welchem denn genau?

Bitte melde dich an um einen Beitrag zu schreiben. Anmeldung ist kostenlos und dauert nur eine Minute.
Bestehender Account
Schon ein Account bei Google/GoogleMail? Keine Anmeldung erforderlich!
Mit Google-Account einloggen
Noch kein Account? Hier anmelden.