blob: b048827fb68d46b920f5b0ed91664b0c3fd87b84 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
library ieee;
use ieee.std_logic_1164.all;
package crash_pkg is
function reorder_vector(inp : std_logic_vector) return std_logic_vector;
end package crash_pkg;
package body crash_pkg is
function reorder_vector(inp : std_logic_vector) return std_logic_vector is
variable ret : std_logic_vector(inp'reverse_range);
begin
return inp;
if inp'left < inp'right then
for i in inp'range loop
ret(inp'right - i) := inp(i);
end loop;
elsif inp'left > inp'right then
for i in inp'range loop
ret(inp'left - i) := inp(i);
end loop;
else
ret(inp'left) := inp(inp'left);
end if;
return ret;
end function;
end package body crash_pkg;
|