Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Accessing PCM Flash memory in a Nexys 3

Status
Not open for further replies.

brobinson

Newbie level 3
Joined
Jun 29, 2012
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,307
Hi,

First post here and completely new to fpga, please be gentle :)

I'm trying to teach myself a bit about FPGA's and have read a bunch of books, done a few experiments with a Nexys 3 board, even managed to get the T80 (Z80 cpu) core up and running, but have now hit a brick wall.

I'm trying to get my T80 project to run code out of the PCM flash ram on the Nexys3 board. I've got it working with a Core Generator ROM module, but not having any luck with the flash ram. The Nexys 3 Reference Manual suggests using the Reference Designs from the Digilent website, but there isn't actually one for the Nexys 3 board -I've asked Digilent and they say there's only one for the Nexys 2, which I've been through. I've read most of the data sheet for Micron NP8P128A13T1760E.

So I've put together the most minimal project I can think of, a simple state machine that attempts to read the first word from the flash ram and display the lower byte on the 8 leds on the board. See the VHDL below. I'm loading up the flash ram using the Adept memory utility, but all I ever seem to get its 0xFF displayed.

My understanding of how it should work is:

1. Set FlashRP = 1, FlashCS = 1, MemOE = 1, MemWR = 1,
2. Set address to MemAdr (I've hard coded to 0)
3. Enable flash - FlashCS = 0
4. Enable out - FlashOE = 0
5. Read from MemDB

My test project runs these steps on a 3.375Mhz clock (since that's what the T80 will run at).

One thing I'm not sure about is the Nexys3 Reference Manual refers to some other signals that are common to the RAM and the Flash - namely CLK, ADV and WAIT - but I've not been able to correlate these to the data sheet for the flash chip.

I'm obviously missing something... any help would be greatly appreciated.


Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.NUMERIC_STD.ALL;


entity Top is
    Port ( clock : in  STD_LOGIC;
           reset : in  STD_LOGIC;
			  led : out STD_LOGIC_VECTOR (7 downto 0);
			  MemOE : out STD_LOGIC;
			  MemWR : out STD_LOGIC;
			  FlashCS : out STD_LOGIC;
			  FlashRP : out STD_LOGIC;
			  MemAdr : out STD_LOGIC_VECTOR(26 downto 1);
			  MemDB : inout STD_LOGIC_VECTOR(15 downto 0)
			  );
end Top;

architecture Behavioral of Top is
	signal slow_clock : STD_LOGIC;
	signal led_reg : STD_LOGIC_VECTOR(7 downto 0);
	signal state : unsigned(3 downto 0) := "0000";
	signal state_next : unsigned(3 downto 0);
begin

	led <= led_reg;

	-- Clock Generation
	clock_core : entity work.ClockCore
		PORT MAP 
		(
			clock => clock,
			clock_3375 => slow_clock,		-- 3.375 Mhz clock
			RESET  => reset
		);

	process (slow_clock, reset)
	begin
		if (reset='1') then
			state <= "0000";
			led_reg <= "00000000";
		elsif (slow_clock'event and slow_clock='1') then
			state <= state_next;
			if (state = "1110") then
				led_reg <= MemDB(7 downto 0);
			end if;
		end if;
	end process;
	
	MemAdr <= "00000000000000000000000000";
	MemDB <= "ZZZZZZZZZZZZZZZZ";
	MemWR <= '1';
	FlashRP <= NOT reset;

	process (state)
	begin
		case state is
			when "0000" =>
				-- initialize
				FlashCS <= '1';
				MemOE <= '1';
			when "0001" =>
				-- enable flash
				FlashCS <= '0';
				MemOE <= '1';
			when "0010" =>
				-- enable flash output
				FlashCS <= '0';
				MemOE <= '0';	
			when others =>
				-- hold steady
				FlashCS <= '0';
				MemOE <= '0';	
		end case;
	end process;
	
	state_next <= "1111" when (state="1111") else state + 1;

end Behavioral;
 

I'm bumping this, hoping for any clue as to what could be wrong. I've tried everything I can think of, can't get anything sensible to happen and no idea what to try next.
 

Doh, never mind... figured it out, hadn't mapped the MemOE pin in the UCF file. Stupid mistake, lesson learned. The originally posted VHDL code works fine.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top