低电压抖动脉冲生成Verilog代码

本文介绍了一个使用Verilog实现的脉冲发生器模块,该模块能够生成精确定时的脉冲信号,如cnv_en、sck_gate等,适用于同步系统中各种信号的精确控制。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

//Module to generate timing pulses

//DJS 6_21_16

 

`timescale 1ps / 1ps

module pulse_generator

(

clk,

sync,

ddr,

cnv_en,

cnvclk_gate,

sck_gate,

rx_start_p,

rx_start_n,

data_latch

);

 

input clk,sync,ddr;

output cnv_en,cnvclk_gate,sck_gate,rx_start_p,rx_start_n,data_latch;

 

reg cnv_en,sck_gate,rx_start_p,rx_start_n,data_latch,cnvclk_gate;

reg [8:0] count; // master counter

//this register resets to '0' while the 'sync' pulse from the PLL is 'high'.

//the following pulses are timed by this count: 'cnv_en', 'sck_gate', 'rx_reset', 'data_latch', 'cnvclk_gate'

 

reg [8:0] tsckgateh,sck_gate_length;

reg [8:0] tcnvclkgateh,cnvclk_gate_length;

reg [8:0] trxstartp,trxstartn,rx_start_length;

reg [8:0] tcnvenh,cnv_en_length;

reg [8:0] tdatalatchh;

wire ddr,sync;

 

//The first rising edge of 'clk' after the 'sync' pulse falls starts the counting process

always @ (posedge clk)

begin

trxstartp = trxstartn - 9'd2; // Time for 'rx_start_p' to go high

trxstartn = tsckgateh + 9'd3; // Time for 'rx_start_n' to go high

tsckgateh = 9'd1; // Time for 'sck_gate' to go high        

// Yields first 'SCK' edge 20nsec after 'CNV' falls

sck_gate_length = 9'd32;

tcnvenh = 9'd34; // Time for 'cnv_en' to go high

cnv_en_length = 9'd7; // Yields 'CNV' pulsewidth of 35nsec

tdatalatchh = tsckgateh + sck_gate_length + 9'd4; // Time for 'data_latch' to go high

tcnvclkgateh = tsckgateh;

cnvclk_gate_length = 9'd16;

if(ddr)

rx_start_length = 9'd4;

else

rx_start_length = 9'd2;     

end

 

initial

  count = 0;

 

always @ (posedge clk)

    if (sync)

  count <= 7'd0;

 else

  count <= count + 7'd1;

 

//generate the 'cnv_en' pulse

always @ (posedge clk)

if (count == tcnvenh)

cnv_en <= 1'b1;

else if (count == tcnvenh + cnv_en_length)

cnv_en <= 1'b0;

else

cnv_en <= cnv_en;

 

//generate the 'sck_gate' pulse

always @ (posedge clk)

if (count == tsckgateh)

sck_gate <= 1'b1;

else if (count == tsckgateh + sck_gate_length)

sck_gate <= 1'b0;

else

sck_gate <= sck_gate;

//generate the 'rx_start_p' pulse

always @ (negedge clk)

if (count == trxstartp)

rx_start_p <= 1'b1;

else if (count == trxstartp + rx_start_length)

rx_start_p <= 1'b0;

//generate the 'rxstart_n' pulse

always @ (posedge clk)

if (count == trxstartn)

rx_start_n <= 1'b1;

else if (count == trxstartn + rx_start_length)

rx_start_n <= 1'b0;

//generate the 'data_latch' pulse

always @ (posedge clk)

if (count == tdatalatchh)

data_latch <= 1'b1;

else if (count == tdatalatchh + 9'd2)

data_latch <= 1'b0;

else

data_latch <= data_latch;

//generate the 'cnvclk_gate' pulse

always @ (negedge clk)

if (count == tcnvclkgateh)

cnvclk_gate <= 1'b1;

else if (count == tcnvclkgateh + cnvclk_gate_length)

cnvclk_gate <= 1'b0;

else

cnvclk_gate <= cnvclk_gate;

 

endmodule


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值