Endianness¶
Nothing to see here, you can skip it…
endianess_vhd¶
endianess.vhd
endianess_vhd module
Imports¶
Imports 3 elements
IEEE std_logic_1164 numeric_std
work common
Parameters¶
Parameters 1 element
- • XLEN Type : INTEGER Default : 32
! @brief Configure the data width in the core.
Ports¶
Ports list 2 elements
Name |
Direction |
Description |
Type |
Size |
Kind |
Polarity |
Fanout |
|---|---|---|---|---|---|---|---|
datain |
Input |
! @brief Data intput, to be swapped from endianness type. |
|
|
Combinatorial |
- |
Fanout : 0 |
dataout |
Output |
! @brief Data output, swapped. |
|
|
Combinatorial |
- |
Fanout : 0 |
Processes¶
Process list 1 element
• Process 1 Combinatorial
- -
Signals¶
Signals list 1 element
Name |
Description |
Type |
Size |
Kind |
Fanout |
|---|---|---|---|---|---|
temp |
|
|
|
Combinatorial |
Fanout : 0 |
Instantiation templates¶
Instantiation templates 2 elements
endianess_vhd <name> #(
.XLEN ( 32)
)(
.datain (i_datain),
.dataout (i_dataout)
);
<name>: entity work.endianess_vhd
generic map (
XLEN => 32
)
port map (
datain => i_datain,
dataout => i_dataout
);
Source¶
Raw source Full file
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;
USE work.common.ALL;
ENTITY endianess_vhd IS
GENERIC (
--! @brief Configure the data width in the core.
XLEN : INTEGER := 32
);
PORT (
--! @brief Data intput, to be swapped from endianness type.
datain : IN STD_LOGIC_VECTOR((XLEN - 1) DOWNTO 0);
--! @brief Data output, swapped.
dataout : OUT STD_LOGIC_VECTOR((XLEN - 1) DOWNTO 0)
);
END ENTITY;
ARCHITECTURE rtl OF endianess_vhd IS
BEGIN
--========================================================================================
--! @brief This process handle the data swapping, and isn't synchronously done.
--! @details
--! This process won't, in fact exist. It's a pure logic representation of a different wirings,
--! which quartus will synthetize as a ... wiring with 0 LUT usage.
--========================================================================================
PROCESS (datain)
VARIABLE temp : STD_LOGIC_VECTOR(XLEN - 1 DOWNTO 0);
BEGIN
-- swap byte by byte
FOR i IN 0 TO (XLEN/8 - 1) LOOP
temp(((i + 1) * 8 - 1) DOWNTO i * 8) :=
datain(((XLEN/8 - 1 - i + 1) * 8 - 1) DOWNTO (XLEN/8 - 1 - i) * 8);
END LOOP;
dataout <= temp;
END PROCESS;
END ARCHITECTURE rtl;
endianess_tb¶
endianess_tb.vhd
endianess_tb testbench
Imports¶
Imports 3 elements
IEEE std_logic_1164 numeric_std
work common
Signals¶
Signals list 2 elements
Name |
Description |
Type |
Size |
Kind |
Fanout |
|---|---|---|---|---|---|
datain_t |
|
|
|
Combinatorial |
Fanout : 0 |
dataout_t |
|
|
|
Combinatorial |
Fanout : 0 |
Modules¶
Processes¶
Process list 1 element
• P1
- -
Source¶
Raw source Full file
LIBRARY IEEE;
USE IEEE.std_logic_1164.ALL;
USE IEEE.numeric_std.ALL;
USE work.common.ALL;
ENTITY endianess_tb IS
END ENTITY;
ARCHITECTURE behavioral OF endianess_tb IS
SIGNAL datain_t : STD_LOGIC_VECTOR(31 DOWNTO 0) := X"deadbeef";
SIGNAL dataout_t : STD_LOGIC_VECTOR(31 DOWNTO 0);
BEGIN
U1 : ENTITY work.endianess(rtl)
GENERIC MAP(
XLEN => 32
)
PORT MAP(
datain => datain_t,
dataout => dataout_t
);
P1 : PROCESS
BEGIN
WAIT FOR 10 ns;
datain_t <= X"aabbccdd";
WAIT FOR 10 ns;
datain_t <= X"eeff1122";
END PROCESS;
END ARCHITECTURE behavioral;