Cyclone2 FPGA读写SRAM IS61LV25616 实验Verilog逻辑源码Quartus工程文件 module SRAM_TEST ( //input input sys_clk , //system clock; input sys_rst_n , //system reset, low is active; //output inout [15:0] SRAM_DQ , output reg [17:0] SRAM_ADDR , output reg SRAM_CE , output reg SRAM_OE , output reg SRAM_WE , output reg SRAM_UB , output reg SRAM_LB , output reg [ 7:0] LED ); //Reg define reg [3:0] div_cnt ; reg sram_clk ; reg [5:0] ctrl_cnt ; reg [15:0] sram_data_lck ; reg [15:0] sram_din ; //Wire define //************************************************************************************ //** Main Program //** //************************************************************************************ // counter used for div osc clk to sram ctrl clk 50M/16 always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) div_cnt <= 4'b0; else div_cnt <= div_cnt + 4'b1; end //gen sram_clk always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) sram_clk <= 1'b0 ; else if ( div_cnt <= 4'd7 ) sram_clk <= 1'b1 ; else sram_clk <= 1'b0 ; end // sram ctrl signal gen // ctrl_cnt 0 - 31 is for write ctrl // ctrl_cnt 31 - 63 is for read ctrl always @(posedge sram_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) ctrl_cnt <= 6'b0; else ctrl_cnt <= ctrl_cnt + 6'b1; end always @(posedge sram_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) SRAM_ADDR <= 18'b0; else if ( ctrl_cnt
Cyclone2 FPGA读写FLASH SST39VF1601 实验Verilog逻辑源码Quartus工程文件 module FLASH_TEST ( //input input sys_clk , //system clock; input sys_rst_n , //system reset, low is active; //output inout [15:0] FLASH_DQ , output reg [20:0] FLASH_ADDR , output reg FLASH_CE , output reg FLASH_OE , output reg FLASH_WE , output reg FLASH_RST , output reg [ 7:0] LED ); //Reg define reg [3:0] div_cnt ; reg flash_clk ; reg [31:0] wait_cnt ; reg [5:0] ctrl_cnt ; reg [15:0] flash_data_lck ; reg [15:0] flash_din ; //Wire define //************************************************************************************ //** Main Program //** //************************************************************************************ // counter used for div osc clk to flash ctrl clk 50M/16 , one flash ctrl clk cycle is 330ns always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) div_cnt <= 4'b0; else div_cnt <= div_cnt + 4'b1; end //gen flash_clk always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) flash_clk <= 1'b0 ; else if ( div_cnt <= 4'd7 ) flash_clk <= 1'b1 ; else flash_clk <= 1'b0 ; end // flash ctrl signal gen // read FLASH devid need 5 step : // ctrl_cnt 10 - 13 is write oxaa in addr 0x5555 // ctrl_cnt 14 - 17 is write ox55 in addr 0x2aaa // ctrl_cnt 18 - 21 is write ox90 in addr 0x5555 // ctrl_cnt 22 -30 is wait time for TIDA // ctrl_cnt 31 -34 is read manId in addr 0 // ctrl_cnt 35 -38 is read devid in addr
Cyclone2 FPGA读写DAC_TLC5620实验Verilog逻辑源码Quartus工程文件 module DA_TLC5620 ( //input input sys_clk , //system clock; input sys_rst_n , //system reset, low is active; //output output reg DA_IO_CLK , output reg DA_LOAD , output reg DA_LDAC , output reg DA_OUT_DATA , output reg [7:0] LED ); //Reg define reg [6:0] div_cnt ; reg da_clk ; reg [4:0] ctrl_cnt ; reg [15:0] delay_cnt ; reg [ 7:0] analog_data ; //Wire define //************************************************************************************ //** Main Program //** //************************************************************************************ // counter used for div osc clk to da ctrl clk 50M/64 = 0.78Mhz always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) div_cnt <= 6'b0; else div_cnt <= div_cnt + 6'b1; end //gen da_clk always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) da_clk <= 1'b0 ; else if ( div_cnt <= 6'd31 ) da_clk <= 1'b1 ; else da_clk <= 1'b0 ; end // da ctrl signal gen // ctrl_cnt 0 - 32 is for da ctrl always @(posedge da_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) ctrl_cnt <= 5'b0; else ctrl_cnt <= ctrl_cnt + 5'b1; end always @(posedge da_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) DA_IO_CLK <= 1'b0; else if ( ctrl_cnt == 5'd6 || ctrl_cnt == 5'd8 || ctrl_cnt == 5'd10 || ctrl_cnt == 5'd12 || ctrl_cnt == 5'd14 || ctrl_cnt == 5'd16 || ctrl_cnt == 5'd18 || ctrl_cnt == 5'd20 || ctrl_cnt == 5'd22 || ctrl_
Cyclone4 FPGA读写高速AD-TLC549+DA-AD9708模块实验Verilog逻辑源码Quartus工程+文档资料 module DA_AD9708_BASE ( //input input sys_clk , //system clock; // input sys_rst_n , //system reset, low is active; input [3:0] key , //output output reg [7:0] DA_DATA , output reg DA_CLK , output reg [7:0] LED ); //Reg define reg [7:0] div_cnt ; //Wire define //************************************************************************************ //** Main Program //** //************************************************************************************ assign sys_rst_n = 1'b1 ; // counter used for div osc clk to ad ctrl clk 50M/4 = 12.5Mhz always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) div_cnt <= 8'b0; else div_cnt <= div_cnt + 8'b1; end //gen DA_CLK always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) DA_CLK <= 1'b0 ; else if ( div_cnt == 8'd0 ) DA_CLK <= ~DA_CLK ; else ; end //display AD sample data to LED always @(posedge DA_CLK or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) DA_DATA <= 8'b0; else DA_DATA <= { key, key }; end //display AD sample data to LED always @(posedge DA_CLK or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) LED <= 8'b0; else LED <= { key, key } ; end
Cyclone2 FPGA读写 ADC_TLC549实验Verilog逻辑源码Quartus工程文件, module AD_TLC549 ( //input input sys_clk , //system clock; input sys_rst_n , //system reset, low is active; input AD_IO_DATA , //output output reg AD_IO_CLK , output reg AD_CS , output reg [7:0] LED ); //Reg define reg [6:0] div_cnt ; reg ad_clk ; reg [4:0] ctrl_cnt ; reg [7:0] ad_data_shift ; //Wire define //************************************************************************************ //** Main Program //** //************************************************************************************ // counter used for div osc clk to ad ctrl clk 50M/64 = 0.78Mhz always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) div_cnt <= 6'b0; else div_cnt <= div_cnt + 6'b1; end //gen ad_clk always @(posedge sys_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) ad_clk <= 1'b0 ; else if ( div_cnt <= 6'd31 ) ad_clk <= 1'b1 ; else ad_clk <= 1'b0 ; end // ad ctrl signal gen // ctrl_cnt 0 - 32is for ad ctrl always @(posedge ad_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) ctrl_cnt <= 5'b0; else ctrl_cnt <= ctrl_cnt + 5'b1; end always @(posedge ad_clk or negedge sys_rst_n) begin if (sys_rst_n ==1'b0) AD_IO_CLK <= 1'b0; else if ( ctrl_cnt == 5'd6 || ctrl_cnt == 5'd8 || ctrl_cnt == 5'd10 || ctrl_cnt == 5'd12 || ctrl_cnt == 5'd14 || ctrl_cnt == 5'd16 || ctrl_cnt == 5'd18 || ctrl_cnt == 5'd20 ) // ad clk low AD_IO_CLK <= 1'b1; else AD_IO_CLK <= 1'b0; end always @(posedge ad_clk or negedge sys_rst
FPGA读写SDRAM page fifo实验完整Verilog逻辑源码Quartus工程文件, Quartus软件版本11.0, FPGA型号为CYCLONE4E系列中的EP4CE6E22C8,可以做为你的学习设计参考。 module sdram_read_write( clk, reset_n, state_signal, rw_done_signal, ar_done_signal, sdram_bank_addr, write_data, read_data, io_ctl, sdram_command, sdram_address, sdram_dqm, sdram_data ); //参数定义 //端口定义 input clk; //时钟信号100MHz input reset_n; //复位信号,低电平有效 input [2:0] state_signal; //状态信号,用于控制对SDRAM进行读写和自刷新 input [21:0] sdram_bank_addr; //SDRAM最小单元地址,[21:20]块地址+[19:8]行地址Row+[7:0]列地址Column input [15:0] write_data; //写入SDRAM的数据 input io_ctl; output rw_done_signal; //读写完成信号 output ar_done_signal; //自动刷新完成信号 output [15:0] read_data; //从SDRAM读出的数据 output [4:0] sdram_command; //SDRAM指令,cke、cs_n、ras、cas_n、we_n,SDRAM指令信号 output [13:0] sdram_address; //SDRAM读写地址 output [1:0] sdram_dqm; //SDRAM数据掩码 inout [15:0] sdram_data; //sdram读写数据 //常量定义 parameter NOP = 5'b10111, //空操作 ACTIVE = 5'b10011, //行激活 READ = 5'b10101, //读操作 WRITE = 5'b10100, //写操作 PR = 5'b10010, //预充电 AR = 5'b10001, //自刷新 LMR = 5'b10000, //设置寄存器 BURST_STOP = 5'b10110; //突发停止指令 parameter ar_state = 3'b001, //自刷新状态 re
FPGA读写SDRAM read_write_a_worde实验完整Verilog逻辑源码Quartus工程文件, Quartus软件版本11.0, FPGA型号为CYCLONE4E系列中的EP4CE6E22C8,可以做为你的学习设计参考。 `timescale 1 ns/ 1 ps // synopsys translate_on module sdram_top( clk, reset_n, sdram_bank_addr, write_data, read_data, read_req, write_req, rw_ack, bus_signal, init_done, sdram_clk, sdram_data, sdram_command, sdram_address, sdram_dqm ); // 系统信号 input clk; //20M系统时钟 input reset_n; //复位信号,低电平有效 // 内部信号 input [21:0] sdram_bank_addr; //读写SDRAM的地址 input [15:0] write_data; //写如sdram的数据 output [15:0] read_data; //从sdram读出的数据 input read_req; //读数据请求信号 input write_req; //写数据请求信号 output rw_ack; //读写应答信号 output bus_signal; //忙信号 output init_done; //初始化完成信号,输出,高电平有效 // SDRAM接口信号 output sdram_clk; //sdram时钟信号 inout [15:0] sdram_data; //sdram读写数据 output [4:0] sdram_command; //cke、cs_n、ras、cas_n、we_n,SDRAM指令信号 output [13:0] sdram_address; //[13:12]BA , [11:0]Addr,SDRAM地址信号 output [1:0] sdram_dqm; //SDRAM数据掩码 //连接线 wire init_start; //初始化开始信号,高电平有效 wire [4:0] sdram_init_command; //cke、cs_n、ras、cas_n、we_n,SDRAM指令信号 wire [4:0] sdram_rw_command; //cke、cs_n、ras、cas_n、we_n,SDRAM指令信号 wire [13:0] sdram_init_address; //[13:12]BA , [11:0]Addr,SDRAM地址信号 wire [13:0] sdram_rw
FPGA读写SDRAM page实验完整Verilog逻辑源码Quartus工程文件, Quartus软件版本11.0, FPGA型号为CYCLONE4E系列中的EP4CE6E22C8,可以做为你的学习设计参考。 // synopsys translate_off `timescale 1 ns/ 1 ps // synopsys translate_on module sdram_top( clk, sdram_100mhz, reset_n, sdram_bank_addr, write_data, read_data, read_req, write_req, rw_ack, bus_signal, init_done, sdram_clk, sdram_data, sdram_command, sdram_address, sdram_dqm ); // 系统信号 input clk; //100M系统时钟 input sdram_100mhz; //100Msdram时钟 input reset_n; //复位信号,低电平有效 // 内部信号 input [21:0] sdram_bank_addr; //读写SDRAM的地址 input [15:0] write_data; //写如sdram的数据 output [15:0] read_data; //从sdram读出的数据 input read_req; //读数据请求信号 input write_req; //写数据请求信号 output rw_ack; //读写应答信号 output bus_signal; //忙信号 output init_done; //初始化完成信号,输出,高电平有效 // SDRAM接口信号 output sdram_clk; //sdram时钟信号 inout [15:0] sdram_data; //sdram读写数据 output [4:0] sdram_command; //cke、cs_n、ras、cas_n、we_n,SDRAM指令信号 output [13:0] sdram_address; //[13:12]BA , [11:0]Addr,SDRAM地址信号 output [1:0] sdram_dqm; //SDRAM数据掩码 //连接线 wire init_start; //初始化开始信号,高电平有效 wire [4:0] sdram_init_command; //cke、cs_n、ras、cas_n、we_n,SDRAM指令信号 wire [4:0] sdram_rw_command; //cke、cs_n、ras、cas_n、we_n,SDRAM指令信号 wire
2021-08-25 13:04:59 7.94MB FPGA读写SDRAM Verilog逻辑源码 EP4CE6E22C8
8线-3线编码器 优先编码器+八选一数据选择器 FPGA设计Verilog逻辑源码Quartus工程文件, Quartus软件版本11.0, FPGA型号为CYCLONE4E系列中的EP4CE6E22C8,可以做为你的学习设计参考。 module yxbm_83(y,eo,gs,i,ei); input [7:0] i; //8位输入i input ei; //使能输入端ei output eo,gs; //使能输出端eo,优先标志端gs output[2:0] y; //3位输出y reg[2:0] y; //3位输出寄存器y reg eo,gs; //使能输出寄存器, always@(i,ei) //电平触发方式,当i跟ei有改变的时候,执行以下操作 begin if(ei==1'b1) //当ei为1的时候 begin y<=3'b111; gs<=1'b1; eo<=1'b1; end else begin if(i[7]==1'b0) //当i的第8为0时候 begin y<=3'b000; gs<=1'b0; eo<=1'b1; end else if(i[6]==1'b0) //当i的第七位为0时候 begin y<=3'b001; gs<=1'b0; eo<=1'b1; end else if(i[5]==1'b0) //当i的第6位为0时候 begin y<=3'b010; gs<=1'b0; eo<=1'b1; end else if(i[4]==1'b0) //当i的第5位为0时候 begin y<=3'b011; gs<=1'b0; eo<=1'b1; end else if(i[3]==1'b0) //当i的第4位为0时候 begin y<=3'b100; gs<=1'b0; eo<=1'b1; end else if(i[2]==1'b0) //当i的第3位为0时候 begin y<=3'b101; gs<=1'b0; eo<=1'b1; end else if(i[1]==1'b0) //当i的第2位为0时候 begin y<=3'b110; gs<=1'b0; eo<=1'b1; end
36个Verilog设计基础代码移位寄存器编码器加法减法器分频器计数器逻辑源码Quartus工程文件合集, Quartus软件版本11.0, FPGA型号为CYCLONE4E系列中的EP4CE6E22C8,可以做为你的学习设计参考。 38decoder 4位串入串出移位寄存器 4位并入串出移位寄存器 5位串入并出移位寄存器 8线-3线优先编码器 8线-3线编码器 D触发器 FIFO JK触发器 RS触发器 T触发器 三态门 串行加法器 偶数分频 八选一数据选择器 减法计数器 半整数分频 双向移位寄存器 只读存储器(ROM) 可变模计数器 可逆计数器 同步计数器 四选一数据选择器 堆栈 奇数分频 异步计数器 流水线-加法器 简单运算单元ALU 随即存储器(RAM)