05.07.2013 Views

Xilinx Synthesis Technology User Guide

Xilinx Synthesis Technology User Guide

Xilinx Synthesis Technology User Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

VHDL<br />

HDL Coding Techniques<br />

Following is the VHDL code for a dual-port RAM with asynchronous<br />

read.<br />

library ieee;<br />

use ieee.std_logic_1164.all;<br />

use ieee.std_logic_unsigned.all;<br />

entity raminfr is<br />

port (clka : in std_logic;<br />

clkb : in std_logic;<br />

wea : in std_logic;<br />

addra: in std_logic_vector(4 downto 0);<br />

addrb: in std_logic_vector(4 downto 0);<br />

dia : in std_logic_vector(3 downto 0);<br />

doa : out std_logic_vector(3 downto 0);<br />

dob : out std_logic_vector(3 downto 0));<br />

end raminfr;<br />

architecture syn of raminfr is<br />

type ram_type is array (31 downto 0) of<br />

std_logic_vector (3 downto 0);<br />

signal RAM: ram_type;<br />

signal read_addra : std_logic_vector(4 downto 0);<br />

signal read_addrb : std_logic_vector(4 downto 0);<br />

begin<br />

process (clka)<br />

begin<br />

if (clka'event and clka = '1') then<br />

if (wea = '1') then<br />

RAM(conv_integer(addra))

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!