⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pulse_gen.v

📁 vga显示源码
💻 V
字号:
//********************************************************
// Filename:  pulse_gen.v
//
// Parameterized pulse_gen module with sync reset. 
// The output is registered.
//
// Basically, just a comparator that outputs a one 
// when the count falls between two values and a 
// zero otherwise. START + LENGTH should fall within 
// the counter range (plus one). That is, this module 
// doesn't deal with counter rollover.
//********************************************************
module pulse_gen(clk,reset,count,pulse);
  parameter N = 8;      // number of counter bits
  parameter START = 0;  // start count
  parameter LENGTH = 1; // pulse length (number of cycles)

  input clk, reset;
  input [N-1:0] count;
  output pulse;
  reg pulse;

  always @(posedge clk)
    if (reset) pulse <= 0;
    else
      begin
        if ((count>=START)&&(count<START+LENGTH)) pulse <= 1;
        else pulse <= 0;
      end
endmodule

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -