Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > How to use SRAM Vhdl with DE2 Board??

Reply
Thread Tools

How to use SRAM Vhdl with DE2 Board??

 
 
Little34 Little34 is offline
Junior Member
Join Date: Apr 2010
Posts: 1
 
      04-15-2010
I have a project in which i have to write binary data to the SRAM and then later read that data from the SRAM and display it to a seven segment display. However this is hard to due since i don't understand how to send/read the data to the SRAM in the first place.

can anyone explain how to write/read data to an SRAM chip in VHDL using the Altera DE2 board with cyclone II chip???
 
Reply With Quote
 
 
 
 
robin244 robin244 is offline
Junior Member
Join Date: Jan 2011
Posts: 1
 
      01-22-2011
Hello,
I know it is late, but this code works:

Note: SW(17) and SW(16) are used to set the address, SW(15) is write enable, SW(7) down to SW(0) are data inputs and LEDR(7) down to LEDR(0) are used to display the memory content of the selected address.

Code:
library ieee;
use ieee.std_logic_1164.all;

entity top_level_entity is
	port(
		SW: in std_logic_vector(17 downto 0);
		LEDR: out std_logic_vector(17 downto 0);
		
		SRAM_ADDR: out std_logic_vector(19 downto 0);
		SRAM_DQ: inout std_logic_vector(15 downto 0);
		SRAM_CE_N: out std_logic;
		SRAM_OE_N: out std_logic;
		SRAM_WE_N: out std_logic;
		SRAM_UB_N: out std_logic;
		SRAM_LB_N: out std_logic
	);
end top_level_entity;


architecture inside_top_level_entity of top_level_entity is

	signal address: std_logic_vector(1 downto 0);
	signal data: std_logic_vector(7 downto 0);
	signal output: std_logic_vector(7 downto 0);
	signal we: std_logic;
	
begin

	address <= SW(17 downto 16);
	data <= SW(7 downto 0) when SW(15) = '1' else (others => 'Z');
	LEDR(7 downto 0) <= output;

	SRAM_WE_N <= not SW(15);
	
	SRAM_CE_N <= '0';
	SRAM_OE_N <= '0';
	SRAM_UB_N <= '0';
	SRAM_LB_N <= '0';
	
	SRAM_ADDR(19 downto 2) <= (others => '0');
	SRAM_ADDR(1 downto 0) <= address;
	
	SRAM_DQ(15 downto 8) <= (others => '0');
	SRAM_DQ(7 downto 0) <= data;
	
	output <= SRAM_DQ(7 downto 0);

end inside_top_level_entity;
 

Last edited by robin244; 01-22-2011 at 12:08 PM..
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Regarding the SPI between ADC and DE2 New2VHDL VHDL 1 12-12-2009 04:58 PM
interface (cdd to DE2) hsvjap VHDL 0 09-15-2008 10:01 AM
SRAM controller bidirectional port VHDL bittor VHDL 0 12-22-2004 02:51 PM
How do I model a 6T SRAM cell in VHDL KM VHDL 1 12-05-2003 08:30 PM



Advertisments