song_top.v

来自「蜂鸣器控制」· Verilog 代码 · 共 77 行

V
77
字号
////////////////////////////////////////////////////////////////////////////////
//       ____  _      __  ___                                                 //
//      / __ \(_)____/ / / (_)____      RICHIC CONFIDENTIAL PROPRIETARY NOTE  //
//     / /_/ / / ___/ /_/ / / ___/      This source codes contains information//
//    / _, _/ / /__/ __  / / /__        confidential and proprietary to RicHic//
//   /_/ |_/_/\___/_/ /_/_/\___/        Inc. It shall not be reproduced in    //
//                                      whole or in part or transferred to    //
//  other documents, or disclosed to third parties, or used for any purpose   //
//  other than that for which it was obtained, without the prior written      //
//  consent of RicHic Inc.                                                    //
//                                                                            //
//    (c) 2003, 2004, 2005 RicHic Inc.                                        //
//                All rights reserved                                         //
// *************************************************************************  //
//                                                                            //
// Email: fpga_ic@yahoo.com.cn; fpga.ic@gmail.com; mail007@richic.com         //
//     http://www.richic.com                                                  //
//                                                                            //
////////////////////////////////////////////////////////////////////////////////

//  本设计在RicHic开发系统中验证通过
//


module song_top
    (
	sp,    
	seg,
	led,
  	clk,
	rst_n
    );
output	        sp;
output   [11:0] seg;
output  [2:0]   led;
input	        clk;
input	        rst_n; // synthesis attribute clock_buffer of rst_n is ibufg;

reg     [23:0]   clk_cnt;
  always @ ( posedge clk or negedge rst_n)
    if (!rst_n )
        clk_cnt <= 24'd0;
    else
        clk_cnt <= clk_cnt + 1'b1;

  wire  clk_6mhz = clk_cnt[2];
  wire  clk_4hz  = clk_cnt[23];
      
wire    [3:0]   high,med,low;      
wire    [6 :0]      led_w ;
wire    [4 :0]      segcode;
wire    [3 :0]      hex;

  assign    led[0] = |{high,med,low};
  assign    led[1] = |{high,med};
  assign    led[2] = |high;
song song_inst
    (
    .clk_6mhz   (clk_6mhz), 
    .clk_4hz    (clk_4hz),
    .sp         ( sp    ),
    .high       ( high  ),
    .med        ( med   ),
    .low        ( low   )
    );

led_top led_top_inst(
    .seg    ( seg   ),    
    .clk    ( clk   ),
    .rst_n  ( rst_n ), 
    .data   ( {4'h0,high,med,low}),
    .dot    ( 4'b0000)
    );


endmodule

⌨️ 快捷键说明

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