Giter VIP home page Giter VIP logo

sdram-controller's Introduction

SDRAM Memory Controller

CURRENT STATUS : stable

This is a very a simple sdram controller which works on the De0 Nano. The project also contains a simple push button interface for testing on the dev board.

Basic features

  • Operates at 100Mhz, CAS 3, 32MB, 16-bit data
  • On reset will go into INIT sequnce
  • After INIT the controller sits in IDLE waiting for REFRESH, READ or WRITE
  • REFRESH operations are spaced evenly 8192 times every 32ms
  • READ is always single read with auto precharge
  • WRITE is always single write with auto precharge

 Host Interface          SDRAM Interface

   /-----------------------------\
   |      sdram_controller       |
==> wr_addr                  addr ==>
==> wr_data             bank_addr ==>
--> wr_enable                data <=>
   |                 clock_enable -->
==> rd_addr                  cs_n -->   
--> rd_enable               ras_n -->
<== rd_data                 cas_n -->
<-- rd_ready                 we_n -->
<-- busy            data_mask_low -->      
   |               data_mask_high -->
--> rst_n                        |
--> clk                          |
   \-----------------------------/

From the above diagram most signals should be pretty much self explainatory. Here are some important points for now. It will be expanded on later.

  • wr_addr and rd_addr are equivelant to the concatenation of {bank, row, column}
  • rd_enable should be set to high once an address is presented on the addr bus and we wish to read data.
  • wr_enable should be set to high once addr and data is presented on the bus
  • busy will go high when the read or write command is acknowledged. busy will go low when the write or read operation is complete.
  • rd_ready will go high when data rd_data is available on the data bus.
  • NOTE For single reads and writes wr_enable and rd_enable should be set low once busy is observed. This will protect from the controller thinking another request is needed if left higher any longer.

Build

The recommended way to build is to use fusesoc. The build steps are then:

# Build the project with quartus
fusesoc build dram_controller
# Program the project to de0 nano
fusesoc pgm dram_controller

# Build with icarus verilog and test
fusesoc sim dram_controller --vcd
gtkwave $fusebuild/dram_controller/sim-icarus/testlog.vcd

# Run other test cases 
fusesoc sim --testbench fifo_tb dram_controller --vcd
fusesoc sim --testbench double_click_tb dram_controller --vcd

Timings

Initialization

wave init

Initialization process showing:

  • Precharge all banks
  • 2 refresh cycles
  • Mode programming

Refresh

wave refresh

Refresh process showing:

  • Precharge all banks
  • Single Refresh

Writes

wave write

Write operation showing:

  • Bank Activation & Row Address Strobe
  • Column Address Strobe with Auto Precharge set and Data on bus

Reads

wave read

Read operation showing:

  • Bank Activation & Row Address Strobe
  • Column Address Strobe with Auto Precharge set
  • Data on bus

Test Application

Test Application Figure - test application block diagram

The test application provides a simple user interface for testing the functionality of the sdram controller.

Basics:

  • The clock input should be 50Mhz (a pll multiplies it up to 100Mhz)
  • One push button is used for reset
  • A Second push button is used for read and write
    • single click for write
    • double click for read
  • A 4-bit dip switch is used for inputting addresses and data
    • Upon reset the read/write addresses are read from the dip switch
    • When writing the dip switch is data is written to the sdram
    • Address and data busses are greather than 4 bits, data is duplicated to fill the bus
  • 8 LEDs are used to display the data read from the sdram. The data but is 16-bits, high and low bytes are alternated on the LEDs about every half second.

Project Status/TODO

  • Compiles
  • Simulated Init
  • Simulated Refresh
  • Simulated Read
  • Simulated Write
  • Confirmed in De0 Nano

Project Setup

This project has been developed with altera quartus II.

License

BSD

Further Reading

I didn't look at these when designing my controller. But it might be good to take a look at for ideas.

sdram-controller's People

Contributors

stffrdhrn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.