📄 led_control.v
字号:
//------------------------------------------------------------------------------
// led_control.v
//
// LED control block for SDV demo board
//
//
//
// Author: John F. Snow
// Staff Applications Engineer
//
// Video Applications
// Advanced Products Group
// Xilinx, Inc.
//
// Copyright (c) 2003 Xilinx, Inc.
// All rights reserved
//
// RESTRICTED RIGHTS LEGEND
//
// This software has not been published by the author, and
// has been disclosed to others for the purpose of enhancing
// and promoting design productivity in Xilinx products.
//
// Therefore use, duplication or disclosure, now and in the
// future should give consideration to the productivity
// enhancements afforded the user of this code by the author's
// efforts. Thank you for using our products !
//
// Disclaimer: THESE DESIGNS ARE PROVIDED "AS IS" WITH NO WARRANTY
// WHATSOEVER AND XILINX SPECIFICALLY DISCLAIMS ANY
// IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR
// A PARTICULAR PURPOSE, OR AGAINST INFRINGEMENT.
//
// $Log: led_control.v,rcs $
// Revision 1.1 2004-12-09 13:25:18-07 jsnow
// Cosmetic changes only.
//
// Revision 1.0 2004-05-25 13:22:37-06 jsnow
// Initial revision
//
//
// Other modules instanced in this design:
// led_blink_divider
//
//------------------------------------------------------------------------------
/*
Description of module:
This module controls the LEDs on the SDV demo board.
For each LED there are three inputs. If the xxx_on input is asserted high, then
the LED will be on constantly, regardless of the other inputs. If the xxx_on
input is low and the xxx_fast input is high, the LED will blink at a rate of
about 4Hz. If the xxx_on and xxx_fast inputs are both low and the xxx_slow
input is high, the LED will blink at a rate of about 1Hz. If none of the inputs
are high, then the LED will be off.
The module currently assumes an input clock of 33MHz and contains a
divider circuit to divide this clock down to the blink frequencies.
The module instances the output buffers for all the LEDs on the SDV demo board.
--------------------------------------------------------------------------------
*/
`timescale 1ns / 1 ps
module led_control (
input wire clk,
input wire mr_tx2_on,
input wire mr_tx2_fast,
input wire mr_tx2_slow,
input wire mr_tx1_on,
input wire mr_tx1_fast,
input wire mr_tx1_slow,
input wire mr_rx_on,
input wire mr_rx_fast,
input wire mr_rx_slow,
input wire asi_tx_on,
input wire asi_tx_fast,
input wire asi_tx_slow,
input wire sdi_rx_on,
input wire sdi_rx_fast,
input wire sdi_rx_slow,
input wire sdi_tx_on,
input wire sdi_tx_fast,
input wire sdi_tx_slow,
input wire mr_sync_on,
input wire mr_sync_fast,
input wire mr_sync_slow,
input wire mr_hd_on,
input wire mr_hd_fast,
input wire mr_hd_slow,
input wire mr_rate_on,
input wire mr_rate_fast,
input wire mr_rate_slow,
input wire sdi_sync_on,
input wire sdi_sync_fast,
input wire sdi_sync_slow,
input wire sdi_rate_on,
input wire sdi_rate_fast,
input wire sdi_rate_slow,
input wire mode_mr_on,
input wire mode_mr_fast,
input wire mode_mr_slow,
input wire mode_sdi_on,
input wire mode_sdi_fast,
input wire mode_sdi_slow,
input wire mode_asi_on,
input wire mode_asi_fast,
input wire mode_asi_slow,
output reg mr_tx2_led,
output reg mr_tx1_led,
output reg mr_rx_led,
output reg asi_tx_led,
output reg sdi_rx_led,
output reg sdi_tx_led,
output reg mr_sync_led,
output reg mr_hd_led,
output reg mr_rate_led,
output reg sdi_sync_led,
output reg sdi_rate_led,
output reg mode_mr_led,
output reg mode_sdi_led,
output reg mode_asi_led,
output wire clk_1Hz
);
wire fast_blink;
wire slow_blink;
always @ *
if (mr_tx2_on)
mr_tx2_led <= 1'b0;
else if (mr_tx2_fast)
mr_tx2_led <= fast_blink;
else if (mr_tx2_slow)
mr_tx2_led <= slow_blink;
else
mr_tx2_led <= 1'b1;
always @ *
if (mr_tx1_on)
mr_tx1_led <= 1'b0;
else if (mr_tx1_fast)
mr_tx1_led <= fast_blink;
else if (mr_tx1_slow)
mr_tx1_led <= slow_blink;
else
mr_tx1_led <= 1'b1;
always @ *
if (mr_rx_on)
mr_rx_led <= 1'b0;
else if (mr_rx_fast)
mr_rx_led <= fast_blink;
else if (mr_rx_slow)
mr_rx_led <= slow_blink;
else
mr_rx_led <= 1'b1;
always @ *
if (asi_tx_on)
asi_tx_led <= 1'b0;
else if (asi_tx_fast)
asi_tx_led <= fast_blink;
else if (asi_tx_slow)
asi_tx_led <= slow_blink;
else
asi_tx_led <= 1'b1;
always @ *
if (sdi_rx_on)
sdi_rx_led <= 1'b0;
else if (sdi_rx_fast)
sdi_rx_led <= fast_blink;
else if (sdi_rx_slow)
sdi_rx_led <= slow_blink;
else
sdi_rx_led <= 1'b1;
always @ *
if (sdi_tx_on)
sdi_tx_led <= 1'b0;
else if (sdi_tx_fast)
sdi_tx_led <= fast_blink;
else if (sdi_tx_slow)
sdi_tx_led <= slow_blink;
else
sdi_tx_led <= 1'b1;
always @ *
if (mr_sync_on)
mr_sync_led <= 1'b0;
else if (mr_sync_fast)
mr_sync_led <= fast_blink;
else if (mr_sync_slow)
mr_sync_led <= slow_blink;
else
mr_sync_led <= 1'b1;
always @ *
if (mr_hd_on)
mr_hd_led <= 1'b0;
else if (mr_hd_fast)
mr_hd_led <= fast_blink;
else if (mr_hd_slow)
mr_hd_led <= slow_blink;
else
mr_hd_led <= 1'b1;
always @ *
if (mr_rate_on)
mr_rate_led <= 1'b0;
else if (mr_rate_fast)
mr_rate_led <= fast_blink;
else if (mr_rate_slow)
mr_rate_led <= slow_blink;
else
mr_rate_led <= 1'b1;
always @ *
if (sdi_sync_on)
sdi_sync_led <= 1'b0;
else if (sdi_sync_fast)
sdi_sync_led <= fast_blink;
else if (sdi_sync_slow)
sdi_sync_led <= slow_blink;
else
sdi_sync_led <= 1'b1;
always @ *
if (sdi_rate_on)
sdi_rate_led <= 1'b0;
else if (sdi_rate_fast)
sdi_rate_led <= fast_blink;
else if (sdi_rate_slow)
sdi_rate_led <= slow_blink;
else
sdi_rate_led <= 1'b1;
always @ *
if (mode_mr_on)
mode_mr_led <= 1'b0;
else if (mode_mr_fast)
mode_mr_led <= fast_blink;
else if (mode_mr_slow)
mode_mr_led <= slow_blink;
else
mode_mr_led <= 1'b1;
always @ *
if (mode_sdi_on)
mode_sdi_led <= 1'b0;
else if (mode_sdi_fast)
mode_sdi_led <= fast_blink;
else if (mode_sdi_slow)
mode_sdi_led <= slow_blink;
else
mode_sdi_led <= 1'b1;
always @ *
if (mode_asi_on)
mode_asi_led <= 1'b0;
else if (mode_asi_fast)
mode_asi_led <= fast_blink;
else if (mode_asi_slow)
mode_asi_led <= slow_blink;
else
mode_asi_led <= 1'b1;
led_blink_counter LEDDIV (
.clk (clk),
.slow (slow_blink),
.fast (fast_blink)
);
assign clk_1Hz = slow_blink;
endmodule
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -