Code optimierung

Gast #3729083
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
Moderator (Firma: Titel) Persönliche Seite #3729094
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?

Antwort schreiben

Hinweis: der ursprüngliche Beitrag ist mehr als 6 Monate alt. Bitte hier nur auf die ursprüngliche Frage antworten, für neue Fragen einen neuen Beitrag erstellen.

Formatierung
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]Code in anderen Sprachen, ASCII-Zeichnungen[/code]
  • [math]Formel in LaTeX-Syntax[/math]
  • [[Titel]] – Link zu einem Artikel
  • Verweis auf einen anderen Beitrag: Rechtsklick auf dessen Beitrags-ID (#8078628), „Adresse kopieren“, in den Text einfügen

Mehr zur Formatierung

Längeren Sourcecode als Anhang, nicht in den Text. JPG nur für Fotos und Scans; Zeichnungen und Screenshots als PNG oder GIF. Siehe Bildformate.

Schon registriert? Anmelden

Wird nicht angezeigt. Wir schicken dir einen Link; sobald du damit bestätigst, erscheint dein Beitrag.

Mit dem Abschicken legst du einen kostenlosen Account an und erkennst die Nutzungsbedingungen und die Datenschutzerklärung an.