/* 
(C) OOMusou 2008 http://oomusou.cnblogs.com

Filename    : DE2_NIOS_Lite.v
Compiler    : Quartus II 7.2 SP3 + ModelSim-Altera 6.1g
Description : DE2_NIOS lite version for SRAM only
Release     : 08/29/2008 1.0
*/
module DE2_NIOS_Lite (
  input         CLOCK_50,     // On Board 50 MHz
  input  [3:0]  KEY,          // Pushbutton[3:0]
  inout  [15:0] SRAM_DQ,      // SRAM Data bus 16 Bits
  output [17:0] SRAM_ADDR,    // SRAM Address bus 18 Bits
  output        SRAM_UB_N,    // SRAM Low-byte Data Mask 
  output        SRAM_LB_N,    // SRAM High-byte Data Mask 
  output        SRAM_WE_N,    // SRAM Write Enable
  output        SRAM_CE_N,    // SRAM Chip Enable
  output        SRAM_OE_N     // SRAM Output Enable
);

wire CPU_CLK;
wire CPU_RESET;

Reset_Delay u0 (
  .iRST(KEY[0]),
  .iCLK(CLOCK_50),
  .oRESET(CPU_RESET)
);

SDRAM_PLL u1 (
  .inclk0(CLOCK_50),
  .c1(CPU_CLK)
);

nios_ii u2 (
  .clk(CPU_CLK),
  .reset_n(CPU_RESET),
  // SRAM
  .SRAM_ADDR_from_the_sram(SRAM_ADDR),
  .SRAM_CE_N_from_the_sram(SRAM_CE_N),
  .SRAM_DQ_to_and_from_the_sram(SRAM_DQ),
  .SRAM_LB_N_from_the_sram(SRAM_LB_N),
  .SRAM_OE_N_from_the_sram(SRAM_OE_N),
  .SRAM_UB_N_from_the_sram(SRAM_UB_N),
  .SRAM_WE_N_from_the_sram(SRAM_WE_N)
);

endmodule