日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

SRAM Controller

發布時間:2024/9/21 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 SRAM Controller 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Abstract

  本實驗實現了對SRAM每一個地址進行遍歷讀/寫操作,然后對比讀寫前后的數據是否一致,最后通過一個LED燈的亮滅進行指示;

Introduction

  DE2-115上用的SRAM是IS61WV102416BL(1Mx16 High-Speed Asynchronous CMOS Static RAM With 3.3V Supply)?

  

  

  

  我們把SRAM_CE,SRAM_OE,SRAM_UB,SRAM_LB置0,這樣寫操作時,只需送數據和地址,同時把SRAM_WE拉低,然后延時Twc時間在把SRAM_WE拉高,這時就把數據寫入相應的地址;讀數據時,只需把需要讀出的地址放到SRAM的地址總線上,然后延遲Taa時間后就可以讀出數據了.

  SRAM寫時序:

  

  SRAM讀時序:

  

sram_controller.v

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 `timescale 1ns/1ps // ********************************************************************* // // Filename: sram_controller.v?????????????????????????????????????????? // // Projects: sram_controller on DE2-115????????????????????????????????? // //?????????? without? external clock???????????????????????????????????? // // Function: check the wirte/read data by led,?????????????????????????? // //?????????? right:LED=1 Wrong:LED=0???????????????????????????????????? //???????????? // Author? : Liu Qiang?????????????????????????????????????????????????? // // Date??? : 2011-11-21????????????????????????????????????????????????? // // Version : 1.0???????????????????????????????????????????????????????? // // Company :???????????????????????????????????????????????????????????? // // ********************************************************************* // ?? module sram_controller( //? intput input clk_50, input rst_n, //? output output[19:0] sram_addr, output sram_wr_n, output sram_ce_n, output sram_oe_n, output sram_ub_n, output sram_lb_n, output led, //? inout inout[15:0] sram_data ); // assign sram_ce_n = 1'b0;??? //sram chip select always enable assign sram_oe_n = 1'b0;??? //sram output always enable assign sram_ub_n = 1'b0;??? //upper byte always available assign sram_lb_n = 1'b0;??? //lower byte always available // reg[25:0] delay;??????? //延時計數器,周期約為1.34s always@(posedge clk_50 or negedge rst_n) ????if(!rst_n) ????????delay <= 26'd0; ????else ????????delay <= delay+1'b1; // reg[15:0] wr_data; reg[15:0] rd_data; reg[19:0] addr_r; wire sram_wr_req; wire sram_rd_req; reg led_r; ?? assign sram_wr_req = (delay == 26'd9999); assign sram_rd_req = (delay == 26'd19999); ?? always@(posedge clk_50 or negedge rst_n) ????if(!rst_n) ????????wr_data <= 16'b0; ????else if(delay == 26'd29999) ????????wr_data <= wr_data+1'b1; ?????????? always@(posedge clk_50 or negedge rst_n) ????if(!rst_n) ????????addr_r <= 20'b0; ????else if(delay == 26'd29999) ????????addr_r <= addr_r+1'b1; ?????? always@(posedge clk_50 or negedge rst_n) ????????if(!rst_n) ????????????led_r <= 1'b0; ????????else if(delay == 26'd29999) ????????????begin ????????????????if(wr_data == rd_data) ????????????????????led_r <= 1'b1; ????????????????else ????????????????????led_r <= 1'b0; ????????????end assign led = led_r; // `define DELAY_80NS? (cnt == 3'd7)?? //80nss取決于Twc的值, cnt=7約140ns; ?? reg[3:0] cstate, nstate; parameter?? IDEL = 4'd0, ????????????WRT0 = 4'd1, ????????????WRT1 = 4'd2, ????????????REA0 = 4'd3, ????????????REA1 = 4'd4; ?????????????? reg[2:0] cnt; always@(posedge clk_50 or negedge rst_n) ????if(!rst_n) ????????cnt <= 3'b0; ????else if(cstate == IDEL) ????????cnt <= 3'b0; ????else ????????cnt <= cnt+1'b1; //? 兩段式狀態機寫法,時序邏輯??????? always@(posedge clk_50 or negedge rst_n) ????if(!rst_n) ????????cstate <= IDEL; ????else ????????cstate <= nstate; //? 兩段式狀態機寫法,組合邏輯??????????? always@(posedge clk_50 or negedge rst_n) ????case(cstate) ????????IDEL:?? if(sram_wr_req) ????????????????????nstate <= WRT0; ????????????????else if(sram_rd_req) ????????????????????nstate <= REA0; ????????????????else ????????????????????nstate <= IDEL; ????????WRT0:?? if(`DELAY_80NS) ????????????????????nstate <= WRT1; ????????????????else ????????????????????nstate <= WRT0; ????????WRT1:?? nstate <= IDEL; ????????REA0:?? if(`DELAY_80NS) ????????????????????nstate <= REA1; ????????????????else ????????????????????nstate <= REA0; ????????REA1:?? nstate <= IDEL; ????????default:nstate <= IDEL; ????endcase ?????? assign sram_addr =addr_r; //? 鎖存數據 reg sdlink;???? //SRAM地址總線控制信號 always@(posedge clk_50 or negedge rst_n) ????if(!rst_n) ????????rd_data <= 16'b0; ????else if(cstate == REA1) ????????rd_data <= sram_data; ?????????? always@(posedge clk_50 or negedge rst_n) ????if(!rst_n) ????????sdlink <= 1'b0; ????else ????????case(cstate) ????????????IDEL:?? if(sram_wr_req) ????????????????????????sdlink <= 1'b1; ????????????????????else if(sram_rd_req) ????????????????????????sdlink <= 1'b0; ????????????????????else? ????????????????????????sdlink <= 1'b0; ????????????WRT0:?? sdlink <= 1'b1; ????????????default:sdlink <= 1'b0; ????????endcase ?????? assign sram_data = sdlink ? wr_data:16'hzzzz; assign sram_wr_n = ~sdlink; ?? endmodule

總結

以上是生活随笔為你收集整理的SRAM Controller的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。