深度为16,位宽8bit的单端口SRAM——学习记录

深度16位宽8bit单端口SRAM学习记录

 

 链接: 

【Verilog HDL 训练】第 13 天(存储器、SRAM)-云社区-华为云

 

 module sram #(
      parameter ADDR_BITS=4
      )(
      input clk,
      input [ 7:0] addr,
      input [ 7:0] din,
      input ce,
      input we,
      output reg [ 7:0] dout
      );
      localparam MEM_DEPTH= 1<<ADDR_BITS;
      reg [7:0] mem[MEM_DEPTH-1:0];
      // synopsys_translate_off
      integer i;
      initial begin
      for(i=0; i<MEM_DEPTH;i=i+1) begin
      mem[i] = 8'h00;
      end
      end
      // synopsys_translate_on
      always @(posedge clk) begin
      if(ce & we) begin
      mem[addr] <= din;
      end
      end
      always @(posedge clk) begin
      if(ce && (!we)) begin
      dout <= mem[addr];
      end
      end
      endmodule
`timescale 1ns 
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值