Subject: CP-010 in address decoding
From: Farrell Ostler (Farrell.Ostler@xilinx.com)
Date: Sat Dec 07 2002 - 08:14:06 PST
Let AB be the number of address bits in a system.
A memory is to be mapped into this space with the address size
of the memory variable up to AB, in which case the memory would
occupy the entire address space. (The actual size of the
memory would be determined at elaboration when the system
generics are evaluated.)
The match function is an attractive primitive for doing the
address decoding for the memory's select signal. Here are
two reasons:
1. Match won't generate simulation warnings during the period of time
from simulation start until the system address gets initialized
out of the 'U' state, as happens, for example, with the overloaded
"=" operator in numeric_std.
2. If there is a desire to economize the address decoding at the
expense of aliasing the memory in a larger address range, the
"match on don't care" behavior caters nicely.
Let MAB be the number of address bits that the memory actually
needs, let A: std_logic_vector(0 to AB-1) be the system
address signal and let SEL: std_logic be the memory select signal.
Then, the decoding could be done as, e.g.,
SEL <= '1' when match(A(0 to AB-MAB-1), "1101...01")
else '0';
The address decoder would work fine for all MAB < AB
but then fail when MAB = AB, although this later case is a perfectly
valid system.
Farrell Ostler
Xilinx
P.S. For reference, I have copied the proposed match implementation,
below.
FUNCTION match ( l, r : std_logic_vector ) RETURN BOOLEAN IS
ALIAS lv : std_logic_vector(1 TO l'LENGTH) IS l;
ALIAS rv : std_logic_vector(1 TO r'LENGTH) IS r;
BEGIN
IF ((l'LENGTH < 1) OR (r'LENGTH < 1)) THEN
ASSERT FALSE
REPORT "STD_LOGIC_1164.MATCH: null detected, returning FALSE"
SEVERITY WARNING;
RETURN FALSE;
END IF;
IF lv'LENGTH /= rv'LENGTH THEN
ASSERT FALSE
REPORT "STD_LOGIC_1164.MATCH: L'LENGTH /= R'LENGTH, returning FALSE"
SEVERITY WARNING;
RETURN FALSE;
ELSE
FOR i IN lv'LOW TO lv'HIGH LOOP
IF NOT (match_table(lv(i), rv(i))) THEN
RETURN FALSE;
END IF;
END LOOP;
RETURN TRUE;
END IF;
END match;
This archive was generated by hypermail 2b28 : Sat Dec 07 2002 - 08:11:35 PST