I am trying to create a generic driver for an SPI-based I / O expander. The idea is to pass initialization values in an instance that matches the requested I / O setting.
My current attempt looks like this:
entity max7301_simple is
generic (
IO_cfg : array (1 to 7) OF integer range 0 to 255 := (16#55#, 16#55#, 16#55#, 16#55#, 16#55#, 16#55#, 16#55#)
);
port (
-- Application interface :
clk_i : in std_logic; -- input clock, xx MHz.
rst_i : in std_logic; -- sync reset.
en_i : in std_logic; -- enable, forces re-init of pins on MAX7301.
output_i : in std_logic_vector(27 downto 0); --data to write to output pins on MAX7301
irq_o : out std_logic; -- IRQ, TODO: what triggers, change on inputs ?
input_o : out std_logic_vector(27 downto 0); --data read from input pins on MAX7301
-- MAX7301 SPI interface
sclk : out std_logic; -- SPI clock
din : in std_logic; -- SPI data input
dout : out std_logic; -- SPI read data
cs : out std_logic -- SPI chip select
);
end max7301_simple;
The problem is with the IO_cfg array, I tried various attempts w / wo init values, etc. And it may not seem like specifying an array.
I believe I read that you can pass the array as a general, but so far it has not been very lucky. Xilinx ISE just reports a “syntax error” next to the “array”, which is not informative enough for me.
Any help would be appreciated
When creating an instance of this module, I always need 7 values.
source
share