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

📄 audio_leds_pb_switches.v

📁 Viertex 2 开发板的接口程序
💻 V
字号:
//     XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS"
//     SOLELY FOR USE IN DEVELOPING PROGRAMS AND SOLUTIONS FOR
//     XILINX DEVICES.  BY PROVIDING THIS DESIGN, CODE, OR INFORMATION
//     AS ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION
//     OR STANDARD, XILINX IS MAKING NO REPRESENTATION THAT THIS
//     IMPLEMENTATION IS FREE FROM ANY CLAIMS OF INFRINGEMENT,
//     AND YOU ARE RESPONSIBLE FOR OBTAINING ANY RIGHTS YOU MAY REQUIRE
//     FOR YOUR IMPLEMENTATION.  XILINX EXPRESSLY DISCLAIMS ANY
//     WARRANTY WHATSOEVER WITH RESPECT TO THE ADEQUACY OF THE
//     IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OR
//     REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM CLAIMS OF
//     INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
//     FOR A PARTICULAR PURPOSE.
//
//     (c) Copyright 2004 Xilinx, Inc.
//     All rights reserved.
//


 /*

-------------------------------------------------------------------------------
   Title      : AUDIO BEEP PASS THROUGH, PUSHBUTTON and DIP SWITCH TEST
   Project    : XUP Virtex-II Pro Development System
-------------------------------------------------------------------------------
   File       : AUDIO_LEDS_PB_SWITCHES.v
   Company    : Xilinx, Inc.
   Created    : 2004/08/12
   Last Update: 2004/08/12
   Copyright  : (c) Xilinx Inc, 2004
-------------------------------------------------------------------------------
   Uses       : 
-------------------------------------------------------------------------------
   Used by    : HW_BIST.v
-------------------------------------------------------------------------------
   Description: This design tests for the presence of the SYSTEM_CLOCK (100MHz),
   		MGT_CLOCK (75MHz) and the SYSTEMACE_CLOCK (32MHz), the functionality of the
		push buttons and the AC97 audio CODEC beep tone pass through and the audio
		power amp.
		The three clocks are divided down and displayed on LED3-1, with LED3
		driven by the 100MHz clock, LED2 driven by the 75MHz clock and LED1 driven 
		by the 32MHz clock. The 100MHz and 75MHz clocks are also used to create five
		tones that are output to the audio codec when the push buttons are pressed.

		After 4 seconds the LEDs will display the status of the DIP switches.
		If the "RESET" pushbutton is pressed the counters are reset_in and the LED
		display reverts to the clock presence detect and the process repeats.


	Conventions:
		All external port signals are UPPER CASE.
		All internal signals are LOWER CASE and are active HIGH.


-------------------------------------------------------------------------------
*/

module CLOCK_AUDIO_PB_SWITCH_TEST (
AUDIO_RESET_Z,
USER_LED0,
USER_LED1,
USER_LED2,
USER_LED3,
BEEP_TONE_IN,
PB_UP,
PB_DOWN,
PB_LEFT,
PB_RIGHT,
PB_ENTER,
DIP_SW0,
DIP_SW1,
DIP_SW2,
DIP_SW3,
CPU_RESET,
_100MHz_clock,
_75MHz_clock,
_32MHz_clock,
reset
);


input 	_100MHz_clock;			// buffered system clock
input 	_75MHz_clock;			// buffered MGT clock
input 	_32MHz_clock;			// buffered systemACE clock
input	reset;				// global reset

output 	AUDIO_RESET_Z;			// RESET FOR THE AC97 AUDIO CODEC
output 	BEEP_TONE_IN;
output	USER_LED0;			// DCM LOCKED
output	USER_LED1;			// SYSTEMACE CLOCK ACTIVE
output	USER_LED2;			// MGT CLOCK ACTIVE
output	USER_LED3;			// SYSTEM CLOCK ACTIVE
input 	PB_UP;
input 	PB_DOWN;
input 	PB_LEFT;
input 	PB_RIGHT;
input 	PB_ENTER;

input 	DIP_SW0;
input 	DIP_SW1;
input 	DIP_SW2;
input 	DIP_SW3;

input 	CPU_RESET;


wire 	AUDIO_RESET_Z;


wire	low = 1'b0;
wire	high = 1'b1;



wire	_32MHz_clock;
wire	_75MHz_clock;
wire	_100MHz_clock;

wire	select_switch_status; // signal to switch the LED display fron clocks to SW status

wire	CPU_RESET;
wire	reset_in;
wire	reset;



reg [27:0] 	counter1;
reg [24:0] 	counter2;
reg [24:0] 	counter3;
reg 		BEEP_TONE_IN;

assign reset_in = !CPU_RESET;
assign select_switch_status = counter1[27]; // switch to SW status after ~5S
assign AUDIO_RESET_Z = 1'b0;	// hold the CODEC in RESET to all the beep tones to pass


// create the counters
always @ (posedge _32MHz_clock or posedge reset_in or posedge reset) begin
	if (reset_in | reset) begin
		counter1 <= 0;
		end
	else if (counter1[27]) begin
		counter1 <= counter1;
		end
	else begin
		counter1 <= counter1 +1;
		end
	end

always @ (posedge _75MHz_clock or posedge reset_in or posedge reset) begin
	if (reset_in | reset) begin
		counter2 <= 0;
		end
	else begin
		counter2 <= counter2 +1;
		end
	end

always @ (posedge _100MHz_clock or posedge reset_in or posedge reset) begin
	if (reset_in | reset) begin
		counter3 <= 0;
		end
	else begin
		counter3 <= counter3 +1;
		end
	end


assign USER_LED0 =  select_switch_status ? DIP_SW0 : reset;
assign USER_LED1 =  select_switch_status ? DIP_SW1 : counter1[24]; //~1HZ
assign USER_LED2 =  select_switch_status ? DIP_SW2 : counter2[24]; //~2HZ
assign USER_LED3 =  select_switch_status ? DIP_SW3 : counter3[24]; //~3HZ


// select a different tone with each push button
always @ (PB_UP or PB_DOWN or PB_LEFT or PB_RIGHT or PB_ENTER or counter3 or counter2) begin
case ({PB_UP,PB_DOWN,PB_LEFT,PB_RIGHT,PB_ENTER})
5'b01111:begin
	BEEP_TONE_IN = counter3[18];
	end
5'b10111:begin
	BEEP_TONE_IN = counter3[17];
	end
5'b11011:begin
	BEEP_TONE_IN = counter2[18];
	end
5'b11101:begin
	BEEP_TONE_IN = counter2[17];
	end
5'b11110:begin
	BEEP_TONE_IN = counter3[16];
	end
default:begin
	BEEP_TONE_IN = 1'b1;
	end
endcase
end

endmodule // CLOCK_AUDIO_PB_SWITCH_TEST

⌨️ 快捷键说明

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