XILINX SPARTAN6 FPGA 双通道的12bit ADC ad9226输入测试程序VERILOG逻辑例程源码 ISE14.7工程文件 module ad9226_test( input clk50m, input reset_n, input rx, //uart rx output tx, //uart tx input [11:0] ad1_in, output ad1_clk, input [11:0] ad2_in, output ad2_clk ); parameter SCOPE_DIV =50; //定义chipscoe的分频系数, assign ad1_clk=clk50m; assign ad2_clk=clk50m; wire [11:0] ad_ch1; wire [11:0] ad_ch2; wire [7:0] ch1_sig; w
2023-12-07 20:36:32 2.31MB ad9226
Cyclone10LP FPGA读写DS1302 RTC实验Verilog逻辑源码Quartus17.1工程文件+文档资料, FPGA为CYCLONE10LP系列中的10CL025YU256C8. 完整的Quartus工程文件,可以做为你的学习设计参考。 通过分析 DS1302 读写时序,可以看出和 SPI 时序类似,只丌过数据输出和输入分时复用了, 本实验利用 SPI Flash 读写实验中已经使用过的 SPI Master 模块来做为 DS1302 的底层读写控制模块, 然后再编写一个 RTC 读写模块。 ds1302_io 模块完成 DS1302 寄存器读写控制,状态机如下图所示。 状态“S_IDLE”空闲状态,收到读写寄存器请求写迚入“S_CE_HIGH”状态,将 CE 拉高,然 后根据请求类型,迚入读(S_READ)戒写状态(S_WRITE)。 “S_WRITE”状态下一个状态迚入写地址状态“S_WRITE_ADDR”,再迚入写数据状态 “S_WRITE_DATA”,完成一个寄存器的写入,最后应答,拉低 CE。 “S_READ”状态下一个状态迚入读地址状态“S_READ_ADDR”,再迚入读数据状态 “S_READ_DATA”,完成一个寄存器的读取,最后应答,拉低 CE。 module top( //sys input clk, input rst_n, output rtc_sclk, output rtc_ce, inout rtc_data, input uart_rx, output uart_tx ); wire[7:0] read_second; wire[7:0] read_minute; wire[7:0] read_hour; wire[7:0] read_date; wire[7:0] read_month; wire[7:0] read_week; wire[7:0] read_year; ds1302_test ds1302_test_m0( .rst (~rst_n), .clk (clk), .ds1302_ce (rtc_ce), .ds1302_sclk (rtc_sclk), .ds1302_io (rtc_data), .read_second (read_second), .read_minute (read_minute), .read_hour (read_hour), .read_date (read_date), .read_month (read_month), .read_week (read_week), .read_year (read_year) ); uart_send uart_send_m0( .clk (clk ), .rst_n (rst_n ), .read_second (read_second ), .read_minute (read_minute ), .read_hour (read_hour ), .read_date (read_date ), .read_month (read_month ), .read_week (read_week ), .read_year (read_year ), .uart_rx (uart_rx ), .uart_tx (uart_tx ) );
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