URL
https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 304 |
Rev 384 |
with GNAT.Heap_Sort_G;
|
with GNAT.Heap_Sort_G;
|
function sort1 (S : String) return String is
|
function sort1 (S : String) return String is
|
Result : String (1 .. S'Length) := S;
|
Result : String (1 .. S'Length) := S;
|
Temp : Character;
|
Temp : Character;
|
|
|
procedure Move (From : Natural; To : Natural) is
|
procedure Move (From : Natural; To : Natural) is
|
begin
|
begin
|
if From = 0 then Result (To) := Temp;
|
if From = 0 then Result (To) := Temp;
|
elsif To = 0 then Temp := Result (From);
|
elsif To = 0 then Temp := Result (From);
|
else Result (To) := Result (From);
|
else Result (To) := Result (From);
|
end if;
|
end if;
|
end Move;
|
end Move;
|
|
|
function Lt (Op1, Op2 : Natural) return Boolean is
|
function Lt (Op1, Op2 : Natural) return Boolean is
|
begin
|
begin
|
if Op1 = 0 then return Temp < Result (Op2);
|
if Op1 = 0 then return Temp < Result (Op2);
|
elsif Op2 = 0 then return Result (Op1) < Temp;
|
elsif Op2 = 0 then return Result (Op1) < Temp;
|
else return Result (Op1) < Result (Op2);
|
else return Result (Op1) < Result (Op2);
|
end if;
|
end if;
|
end Lt;
|
end Lt;
|
|
|
package SP is new GNAT.Heap_Sort_G (Move, Lt);
|
package SP is new GNAT.Heap_Sort_G (Move, Lt);
|
|
|
begin
|
begin
|
SP.Sort (S'Length);
|
SP.Sort (S'Length);
|
return Result;
|
return Result;
|
end;
|
end;
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.