LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-09-2007, 03:18 PM   #1
Four
Member
 
Registered: Aug 2005
Posts: 298

Rep: Reputation: 30
FPGA's using flash memory


Hi,

I have an Altera DE1 board ( http://www.terasic.com.tw/cgi-bin/pa...oryNo=39&No=83 )

On it there is a flash chip that is 4MB according to the manual. I tryed looking at the numbers of the chip and googling it but got no response back on how to use this memory.

The mapping of pins are as follows

// bidirectional data
inout [7 : 0] FL_DQ;
// address
output [21 : 0] FL_ADDR;
// write enable, output enable, reset enabled
output FL_WE_N, FL_OE_N, FL_RST_N;

This is similar to the sram chip onboard. The only difference is the FL_RST_N, and there is no chip select pin. I adapted the verilog code to this but no luck in reading/writing successfully.

Code:
module flashMemoryctl(
		clk,
		cs, // request signal
		addr, // address
		we, // do a write?
		setData, // data to write
		outData, // data read
		ready, // please read now
		FL_DQ, 
		FL_ADDR, 
		FL_WE_N, 
		FL_OE_N, 
		FL_RST_N,
		res // reset state machine active low
		);
		
	// flash parts
	inout [7 : 0] FL_DQ;
	output [21 : 0] FL_ADDR;
	output FL_WE_N, FL_OE_N, FL_RST_N;
	//assign FL_RST_N = res;
	// host parts
	input clk;
	input cs;
	input [21: 0] addr;
	input we;
	input [8 : 0] setData;
	output [8  : 0] outData;
	output ready;
	
	input res;

	wire [8 : 0] sramDina;
	wire [8 : 0] sramDout;
	wire done;
	assign FL_ADDR = addr;
	



	assign FL_OE_N = we? 1'b1 : 1'b0;
	assign sramDout = we? 8'bz : FL_DQ ;
	assign sramDina = we? setData : 8'bz;
	assign FL_DQ = sramDina; 
	
	assign FL_RST_N = res;
	srwFlash(clk, cs, res, we,  FL_WE_N, done);
	
	assign ready = done ;
	assign outData = sramDout;

	
endmodule

module srwFlash(clk, r, res, w,  we,  now, ss);

	input clk, r; // clock / read
	
	input res; // reset
	input w; // write?
	output  we, now;
	output [4 : 0] ss; // output of state
	wire [15 :0] st, nst; // current + next state
	assign ss = st[4 : 0];
	memory16(clk, 1'b1, nst, st);
	
	// waiting for button press (r = 1)
	assign nst[0] = ((~r & st[0]) | (~r & st[3])) | ~res;
	// CS=1
	assign nst[1] = res & ((r&st[0]));

	// we = 0
	assign nst[2] = (st[1]) & res;
	// cs - 0 waiting for button release
	assign nst[3] = ( (st[3] & r) | st[2]) & res;
	
	//assign rs = ~st[1];
	assign we = ~( (st[2] | st[3] ) & w);
// memory is ready to be read
	assign now = st[3]  | st[2];
endmodule
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash memory as Video memory in Ubuntu? caa1980 Ubuntu 6 10-25-2007 11:55 AM
USB memory, Compact Flash, Memory Stick energiza Linux - Hardware 2 08-22-2006 09:29 PM
Missing memory in USB stick, flash memory, removable hd etc bamboo_spider Linux - Newbie 3 06-14-2006 05:39 PM
flash memory rilians Linux - Hardware 1 07-25-2004 01:45 AM
using my flash memory amjad Linux - General 1 11-11-2003 05:00 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration