Devo creare una rom look-up-table(14 bit in ingresso e 12 in uscita ) con valori del seno che provvederò a calcolare con matlab.
Si potrebbe avere del codice per scriverla in vhdl?????
-- Quartus II VHDL Template
-- Single-Port ROM
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity single_port_rom is
generic
(
DATA_WIDTH : natural := 12;
ADDR_WIDTH : natural := 14
);
port
(
clk : in std_logic;
addr : in natural range 0 to 2**ADDR_WIDTH - 1;
q : out std_logic_vector((DATA_WIDTH -1) downto 0)
);
end entity;
architecture rtl of single_port_rom is
-- Build a 2-D array type for the RoM
subtype word_t is std_logic_vector((DATA_WIDTH-1) downto 0);
type memory_t is array(2**ADDR_WIDTH-1 downto 0) of word_t;
function init_rom
return memory_t is
variable tmp : memory_t := (others => (others => '0'));
begin
for addr_pos in 0 to 2**ADDR_WIDTH - 1 loop
-- Initialize each address with the address itself
tmp(addr_pos) := std_logic_vector(to_unsigned(addr_pos, DATA_WIDTH));
end loop;
return tmp;
end init_rom;
-- Declare the ROM signal and specify a default value. Quartus II
-- will create a memory initialization file (.mif) based on the
-- default value.
signal rom : memory_t := init_rom;
begin
process(clk)
begin
if(rising_edge(clk)) then
q <= rom(addr);
end if;
end process;
end rtl;
WIDTH=8;
DEPTH=8;
ADDRESS_RADIX=UNS;
DATA_RADIX=UNS;
CONTENT BEGIN
0 : 23;
1 : 34;
2 : 0;
3 : 255;
4 : 0;
5 : 123;
6 : 255;
7 : 0;
END;
WIDTH=8;
DEPTH=8;
ADDRESS_RADIX=HEX;
DATA_RADIX=BIN;
CONTENT BEGIN
0 : 00010111;
1 : 00100010;
2 : 00000000;
3 : 11111111;
[4..5] : 00000000;
6 : 11111111;
7 : 00000000;
END;
Users browsing this forum: No registered users and 16 guests