Cyclone10 FPGA读写MP25P16 spiflash实验Verilog源码Quartus17.1工程文件+文档资料

上传者: SKCQTGZX | 上传时间: 2021-12-12 09:08:55 | 文件大小: 4.81MB | 文件类型: ZIP
Cyclone10 FPGA读写MP25P16 spiflash实验Verilog源码Quartus17.1工程文件+文档资料,, FPGA为CYCLONE10LP系列中的10CL025YU256C8. 完整的Quartus工程文件,可以做为你的学习设计参考。 module spi_flash_top( input sys_clk, input rst, output nCS, output DCLK, output MOSI, input MISO, input[15:0] clk_div, input[3:0] cmd, input cmd_valid, output cmd_ack, input[23:0] addr, input[7:0] data_in, input[8:0] size, output data_req, output reg[7:0] data_out, output reg data_valid ); localparam S_IDLE = 0; localparam S_SE = 1; localparam S_BE = 2; localparam S_READ = 3; localparam S_WRITE = 4; localparam S_ACK = 5; localparam S_CK_STATE = 6; //present state monitor localparam S_WREN = 7; wire spi_flash_cmd_ack; reg[3:0] sub_cmd; reg sub_cmd_valid; reg[8:0] sub_size; reg[4:0] state,next_state; reg[7:0] state_reg; wire sub_data_valid; wire[7:0] sub_data_in; wire[7:0] sub_data_out; assign sub_data_in = data_in; assign cmd_ack = (state == S_ACK); always@(posedge sys_clk or posedge rst) begin if(rst==1) state <= S_IDLE; else state <= next_state; end always@(*) begin case(state) S_IDLE: if(cmd_valid && cmd == `CMD_BE) next_state <= S_WREN; else if(cmd_valid && cmd == `CMD_SE) next_state <= S_WREN; else if(cmd_valid && cmd == `CMD_READ) next_state <= S_READ; else if(cmd_valid && cmd == `CMD_PP) next_state <= S_WREN; else next_state <= S_IDLE; S_WREN: if(spi_flash_cmd_ack && cmd == `CMD_BE) next_state <= S_BE; else if(spi_flash_cmd_ack && cmd == `CMD_SE) next_state <= S_SE; else if(spi_flash_cmd_ack && cmd == `CMD_PP) next_state <= S_WRITE; else next_state <= S_WREN; S_BE: if(spi_flash_cmd_ack) next_state <= S_CK_STATE;//读取状态寄存器 else next_state <= S_BE; S_SE: if(spi_flash_cmd_ack) next_state <= S_CK_STATE;

文件下载

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明