J
Jeremy Ralph
Guest
The two incarnations of the is_address_word() function (below)
simulate the same but FPGA prototype differently (on an unnamed FPGA
synthesis tool). The purpose of this function is for decoding a
specific index of a register array in a register-map.
So my question for the VHDL gurus out there... should Version 1 of
is_addressed_word() FPGA prototype the same as it simulates?
SUBTYPE addr_type IS std_logic_vector (ADDR_WIDTH-1 DOWNTO 0);
-- Version 1: works differently in sim vs. synth
FUNCTION is_addressed_word (
CONSTANT specific_addr : addr_type;
CONSTANT index : INTEGER := 0;
SIGNAL current_addr : addr_type
) RETURN BOOLEAN IS
CONSTANT specific_indexed_addr : procreg_addr_type :=
std_logic_vector(UNSIGNED( specific_addr) + index *
PROCREG_ADDR_INC);
BEGIN
RETURN (
current_addr(current_addr'left DOWNTO 2) =
specific_indexed_addr(current_addr'left DOWNTO 2)
);
END FUNCTION is_addressed_word;
-- Version 2: works same for sim vs. synth
FUNCTION is_addressed_word (
CONSTANT specific_addr : addr_type;
CONSTANT index : NATURAL;
SIGNAL current_addr : addr_type
) RETURN BOOLEAN IS
-- Ignore the last two bits... don't worry about byte addresssing
-- stick to 32 bit aligned words.
CONSTANT saddr_const : std_logic_vector(specific_addr'LENGTH-3
DOWNTO 0)
:= specific_addr(current_addr'LENGTH-1 DOWNTO 2);
CONSTANT indexed_saddr_const :
std_logic_vector(specific_addr'LENGTH-3 DOWNTO 0)
:= std_logic_vector(UNSIGNED( saddr_const ) + index);
VARIABLE caddr_const : std_logic_vector(specific_addr'LENGTH-3
DOWNTO 0)
:= current_addr(current_addr'LENGTH-1 DOWNTO 2);
BEGIN
RETURN ( caddr_const = indexed_saddr_const );
END FUNCTION is_addressed_word;
Thanks,
Jeremy
-------------
SpectaReg automates slave memory-map deliverables targeting standard
protocols. Learn more at http://www.productive-eda.com.
simulate the same but FPGA prototype differently (on an unnamed FPGA
synthesis tool). The purpose of this function is for decoding a
specific index of a register array in a register-map.
So my question for the VHDL gurus out there... should Version 1 of
is_addressed_word() FPGA prototype the same as it simulates?
SUBTYPE addr_type IS std_logic_vector (ADDR_WIDTH-1 DOWNTO 0);
-- Version 1: works differently in sim vs. synth
FUNCTION is_addressed_word (
CONSTANT specific_addr : addr_type;
CONSTANT index : INTEGER := 0;
SIGNAL current_addr : addr_type
) RETURN BOOLEAN IS
CONSTANT specific_indexed_addr : procreg_addr_type :=
std_logic_vector(UNSIGNED( specific_addr) + index *
PROCREG_ADDR_INC);
BEGIN
RETURN (
current_addr(current_addr'left DOWNTO 2) =
specific_indexed_addr(current_addr'left DOWNTO 2)
);
END FUNCTION is_addressed_word;
-- Version 2: works same for sim vs. synth
FUNCTION is_addressed_word (
CONSTANT specific_addr : addr_type;
CONSTANT index : NATURAL;
SIGNAL current_addr : addr_type
) RETURN BOOLEAN IS
-- Ignore the last two bits... don't worry about byte addresssing
-- stick to 32 bit aligned words.
CONSTANT saddr_const : std_logic_vector(specific_addr'LENGTH-3
DOWNTO 0)
:= specific_addr(current_addr'LENGTH-1 DOWNTO 2);
CONSTANT indexed_saddr_const :
std_logic_vector(specific_addr'LENGTH-3 DOWNTO 0)
:= std_logic_vector(UNSIGNED( saddr_const ) + index);
VARIABLE caddr_const : std_logic_vector(specific_addr'LENGTH-3
DOWNTO 0)
:= current_addr(current_addr'LENGTH-1 DOWNTO 2);
BEGIN
RETURN ( caddr_const = indexed_saddr_const );
END FUNCTION is_addressed_word;
Thanks,
Jeremy
-------------
SpectaReg automates slave memory-map deliverables targeting standard
protocols. Learn more at http://www.productive-eda.com.