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

📄 sync.v

📁 Verilog实现mini-uart
💻 V
字号:
//============================================================================
//
//        Title     : UART SYNCHRONIZER DESIGN
//        Author    : JP LIU
//
//=============================================================================
//
//        File Name      : sync.v
//        Module Name    : sync
//
//=============================================================================
//
// This is a double-rank synchronizer
//
//=============================================================================

module sync
(
 // INPUT PORT
 clk_in,
 sys_rst_b,
 d,

 // OUTPUT PORT
 q
);

////////////////////////////////////////////// 
//
// INPUT AND OUTPUT DECLARATION             //
//
//////////////////////////////////////////////

input  clk_in;
input  sys_rst_b;
input  d;

output q;

/////////////////////////////////////////////
//
// WIRE AND REG DECLARATION                //
//
/////////////////////////////////////////////

reg  pipe1, pipe2;

/////////////////////////////////////////////
//  SEQUENCAL LOGIC                        //
/////////////////////////////////////////////

always @(posedge clk_in or negedge sys_rst_b)
  if (~sys_rst_b) 
     begin
        pipe1 <= 0;
        pipe2 <= 0;
     end 
  else 
     begin
        pipe1 <= d;
        pipe2 <= pipe1;
     end

assign q = pipe2;

endmodule

⌨️ 快捷键说明

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