Hello,
here's an example for ROM inferred from HDL, just a few snippets
--- Quote Start ---
GENERIC
(
NNCO : INTEGER := 10; -- output amplitude resolution
NAKKUI : INTEGER := 10; -- akku integer bits = phase resolution
);
--
--
ARCHITECTURE rtl OF nco IS
CONSTANT ROMSIZE : INTEGER := 2**(NAKKUI-1);
CONSTANT ROMMAX : INTEGER := 2**(NNCO-1)-1;
TYPE SINTAB IS ARRAY(0 TO ROMSIZE-1) OF STD_LOGIC_VECTOR (NNCO-2 DOWNTO 0);
SIGNAL SINROM: SINTAB;
BEGIN
-- For FPGA devices, this construct infers ROM sine table,
-- for RAMless devices (MAX II) an LE based table instead
-- only the 0..pi positive half is represented
GENROM:
FOR idx in 0 TO ROMSIZE-1 GENERATE
CONSTANT x: REAL := SIN(real(idx)*MATH_PI/real(ROMSIZE));
CONSTANT xn: UNSIGNED (NNCO-2 DOWNTO 0) := CONV_UNSIGNED(INTEGER(x*real(ROMMAX)),NNCO-1);
BEGIN
SINROM(idx) <= STD_LOGIC_VECTOR(xn);
END GENERATE;
--- Quote End ---
I hope the method can be seen from the snippets.
Regards,
Frank