LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.numeric_std.all;
PACKAGE io_switches_pins IS
TYPE t_io_switches_pins IS
RECORD
sw: std_logic_vector(3 DOWNTO 0);
east: std_logic;
north: std_logic;
south: std_logic;
west: std_logic;
center: std_logic;
rot_a: std_logic;
rot_b: std_logic;
END RECORD;
CONSTANT c_io_switches_pins_default: t_io_switches_pins := (
sw => "0000",
east => '0',
north => '0',
south => '0',
west => '0',
center => '0',
rot_a => '1',
rot_b => '1'
);
FUNCTION io_switches_to_slv(switches: t_io_switches_pins)
RETURN std_logic_vector;
FUNCTION io_switches_from_slv(slv: std_logic_vector(31 DOWNTO 0))
RETURN t_io_switches_pins;
END PACKAGE io_switches_pins;
PACKAGE BODY io_switches_pins IS
FUNCTION io_switches_to_slv(switches: t_io_switches_pins)
RETURN std_logic_vector IS
VARIABLE v_slv: std_logic_vector(31 DOWNTO 0);
BEGIN
v_slv( 3 DOWNTO 0) := switches.sw;
v_slv( 7 DOWNTO 4) := (OTHERS => '0');
v_slv( 8) := switches.east;
v_slv( 9) := switches.north;
v_slv(10) := switches.south;
v_slv(11) := switches.west;
v_slv(15 DOWNTO 12) := (OTHERS => '0');
v_slv(16) := switches.center;