⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ram_single_port_128x8.v

📁 Xilinx Ise 官方源代码盘 第四章
💻 V
字号:
/*-----------------------------------------------------------------------------
--             Single port RAM inference using Synplify                      --
--                  (Distributed RAM example)                                --
-------------------------------------------------------------------------------
--
-- GENERAL:
--   Synplify can infer a variety RAMs from HDL source code and generate single
--   or dual port RAMs using the distributed or Block RAM resources.
--
-- RAM resources: (See Virtex-II Handbook for details)
--    - Distributed RAM
--       - Single or dual port
--       - Synchronous write and synchronous or asynchronous read
--       - Positive or negative edge clock
--    - BlockRAM
--       - Single or dual port
--       - Synchronous read and write
--       - 18 kbits blocks
--       - Different modes to help manage possible read/write conflict
--
-- NOTES:
--    - Mapping RAM into Distributed RAM
--       - Synplify default
--    - Mapping RAM to BlockRAM
--       Behavioral description must be a one-to-one correspondence with
--         the following BlockRam signals:
--          - read and write clocks
--          - read and write addresses
--          - write enable
-- Log file message:
--     - Synplicity VHDL Compiler section
--         @N:"file.vhd":67:14:67:16|Found RAM mem, depth=128, width=8
--     - Resource Usage Report section
--         RAM128X1S       8 uses
-------------------------------------------------------------------------------
-- Example: Distributed 128x8 single port RAM with synchronous read & write
-----------------------------------------------------------------------------*/

module ram_single_port_128x8 (di, addr, we, clk, do);
  parameter data_width = 8, addr_width = 7; 

  input  [data_width-1 : 0] di; 
  input  [addr_width-1 : 0] addr; 
  input                     we;
  input                     clk;
  output [data_width-1 : 0] do; 

  reg    [data_width-1 : 0] do; 
  reg    [data_width-1 : 0] mem [(1 << addr_width)-1 : 0] /* synthesis syn_ramstyle = "select_ram" */ ; 
  // value: "select_ram"  forces Distributed RAM implementation (default)
  // value: "registers"   forces Registers   RAM implementation
  // value: "block_ram"   forces BlockRAM    RAM implementation
  // value: "no_rw_check" forces BlockRAM    RAM implementation with no
  //                                  read/write address conflict checking

  always @(posedge clk) 
    if (we == 1'b1)
      mem[addr] = di; 
    else 
      do = mem[addr]; 

endmodule 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -