Merge pull request 'ganimede-package' (#7) from ganimede-package into main
Reviewed-on: #7
This commit is contained in:
commit
899877d47f
67
src/io_type_pkg.vhd
Normal file
67
src/io_type_pkg.vhd
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
library IEEE;
|
||||||
|
use IEEE.std_logic_1164.all;
|
||||||
|
use IEEE.MATH_REAL.all;
|
||||||
|
|
||||||
|
package io_types is
|
||||||
|
|
||||||
|
--- STANDARD TYPES ---
|
||||||
|
type ext_protocol_impl_t is record
|
||||||
|
payload, control: STD_LOGIC_VECTOR;
|
||||||
|
end record ext_protocol_impl_t;
|
||||||
|
|
||||||
|
type int_protocol_impl_t is record
|
||||||
|
payload : STD_LOGIC_VECTOR;
|
||||||
|
-- ADD MORE STUFF WHEN WE HAVE DECIDED UPON DRIVER INTERFACE
|
||||||
|
end record int_protocol_impl_t;
|
||||||
|
|
||||||
|
type ext_protocol_def_t is record
|
||||||
|
name: string (1 to 20);
|
||||||
|
payload_width: natural;
|
||||||
|
control_width_in, control_width_out: natural;
|
||||||
|
end record ext_protocol_def_t;
|
||||||
|
|
||||||
|
type interface_inst_t is record
|
||||||
|
socbridge: ext_protocol_def_t;
|
||||||
|
spi: ext_protocol_def_t;
|
||||||
|
end record interface_inst_t;
|
||||||
|
|
||||||
|
--- PROTOCOL INFORMATION ---
|
||||||
|
constant interface_inst : interface_inst_t := (
|
||||||
|
("SoCBridge ", 8, 2, 2),
|
||||||
|
("SPI ", 1, 3, 3)
|
||||||
|
);
|
||||||
|
|
||||||
|
--- AUTOGENERATED TYPES ---
|
||||||
|
type ext_interface_in_t is record
|
||||||
|
socbridge : ext_protocol_impl_t(
|
||||||
|
payload(interface_inst.socbridge.payload_width - 1 downto 0),
|
||||||
|
control(interface_inst.socbridge.control_width_in - 1 downto 0));
|
||||||
|
spi : ext_protocol_impl_t(
|
||||||
|
payload(interface_inst.spi.payload_width - 1 downto 0),
|
||||||
|
control(interface_inst.spi.control_width_in - 1 downto 0));
|
||||||
|
end record ext_interface_in_t;
|
||||||
|
|
||||||
|
type ext_interface_out_t is record
|
||||||
|
socbridge : ext_protocol_impl_t(
|
||||||
|
payload(interface_inst.socbridge.payload_width - 1 downto 0),
|
||||||
|
control(interface_inst.socbridge.control_width_out - 1 downto 0));
|
||||||
|
spi : ext_protocol_impl_t(
|
||||||
|
payload(interface_inst.spi.payload_width - 1 downto 0),
|
||||||
|
control(interface_inst.spi.control_width_out - 1 downto 0));
|
||||||
|
end record ext_interface_out_t;
|
||||||
|
|
||||||
|
type int_interface_in_t is record
|
||||||
|
socbridge : int_protocol_impl_t(
|
||||||
|
payload(interface_inst.socbridge.payload_width - 1 downto 0));
|
||||||
|
spi : int_protocol_impl_t(
|
||||||
|
payload(interface_inst.spi.payload_width - 1 downto 0));
|
||||||
|
end record int_interface_in_t;
|
||||||
|
|
||||||
|
type int_interface_out_t is record
|
||||||
|
socbridge : int_protocol_impl_t(
|
||||||
|
payload(interface_inst.socbridge.payload_width - 1 downto 0));
|
||||||
|
spi : int_protocol_impl_t(
|
||||||
|
payload(interface_inst.spi.payload_width - 1 downto 0));
|
||||||
|
end record int_interface_out_t;
|
||||||
|
|
||||||
|
end package io_types;
|
||||||
27
src/test.vhd
Normal file
27
src/test.vhd
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
library IEEE;
|
||||||
|
library work;
|
||||||
|
use work.io_types.all;
|
||||||
|
|
||||||
|
entity test is
|
||||||
|
port (
|
||||||
|
ext_interface_in : in ext_interface_in_t;
|
||||||
|
ext_interface_out : out ext_interface_out_t
|
||||||
|
);
|
||||||
|
end entity test;
|
||||||
|
|
||||||
|
architecture rtl of test is
|
||||||
|
signal int_interface_in : int_interface_in_t;
|
||||||
|
signal int_interface_out : int_interface_out_t;
|
||||||
|
begin
|
||||||
|
|
||||||
|
proc_name: process
|
||||||
|
begin
|
||||||
|
|
||||||
|
report "Hello";
|
||||||
|
report integer'image(ext_interface_in.socbridge.payload'length);
|
||||||
|
report integer'image(ext_interface_in.spi.payload'length);
|
||||||
|
wait;
|
||||||
|
end process proc_name;
|
||||||
|
|
||||||
|
|
||||||
|
end architecture rtl;
|
||||||
Loading…
x
Reference in New Issue
Block a user