还有,今天偶尔看到一个地方写到XST可以强制综合成ram的。 程序如下: library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all;
entity logic_bram is port (clk,rst : in std_logic; a,b,c,d : in unsigned(7 downto 0); res1,res2 : out unsigned(7 downto 0) ); end logic_bram;
architecture behav of logic_bram is begin process(clk) begin if rising_edge(clk) then if (rst='1') then res1 <= "00000000" ; res2 <= "00000000" ; else res1 <= a + b; res2 <= c + d; end if; end if; end process; end behav;
书中在end logic_bram前面加上: attribute bram_map:string; attribute bram_map of logic_bram:entity is "yes"; 就可以这两个8位加法器放入到块存储器中了。