Compare commits
7 commits
6ff0e77d38
...
0230edd2fb
Author | SHA1 | Date | |
---|---|---|---|
0230edd2fb | |||
2cc32eb4c2 | |||
ea8e6d4b49 | |||
62a06c6bcd | |||
b97c708148 | |||
bad48d0e9b | |||
dc31375b55 |
1 changed files with 0 additions and 23 deletions
|
@ -1,23 +0,0 @@
|
||||||
library ieee;
|
|
||||||
use ieee.std_logic_1164.all;
|
|
||||||
|
|
||||||
package util is
|
|
||||||
function flip_endianness(val : in std_logic_vector) return std_logic_vector;
|
|
||||||
end package;
|
|
||||||
|
|
||||||
package body util is
|
|
||||||
function flip_endianness(val : in std_logic_vector) return std_logic_vector is
|
|
||||||
constant BYTES : natural := val'length / 8;
|
|
||||||
variable ret : std_logic_vector(val'length-1 downto 0);
|
|
||||||
begin
|
|
||||||
assert val'length mod 8 = 0
|
|
||||||
report "length of vector not a multiple of 8"
|
|
||||||
severity failure;
|
|
||||||
|
|
||||||
for i in 0 to BYTES-1 loop
|
|
||||||
ret((BYTES-i)*8 - 1 downto (BYTES-i-1) * 8) := val((i+1)*8 - 1 downto i*8);
|
|
||||||
end loop;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
end function;
|
|
||||||
end package body;
|
|
Loading…
Reference in a new issue