//===========================================================================
//Wire and reg declaration
//===========================================================================
wire SYSCLK_50M;
wire RST_B;
reg [5:0] LED_DATA;
wire PUSH_SW1;
//wire key;
//===========================================================================
//Wire and reg in the module
//===========================================================================
reg [23:0] TIME_CNT; //Count the time, everyone show 1ms.
reg [5:0] LED_DATA_N; //Next value of LED_DATA.
各位大侠 PUSH_SW1是拨码开关,我想的是拨码开关为高电平时正向流动,为低电平时反向流动,可现在是低电平能正常流动,高电平时停止不动啊
begin
if(!RST_B)
TIME_CNT <= `UD 21'b0;
else
TIME_CNT <= `UD TIME_CNT_N;
end
assign TIME_CNT_N = TIME_CNT + 21'b1;
always @(negedge RST_B or negedge SYSCLK_50M)
begin
if(!RST_B)
LED_DATA <= `UD 6'b11_1110;//这里LED同样是低电平有效,初值只允许一个LED亮
else
LED_DATA <= `UD LED_DATA_N;
end
(
//Input ports.
SYSCLK_50M,
RST_B,
PUSH_SW1,
//Output ports.
LED_DATA
);
//===========================================================================
//Input and output declaration
//===========================================================================
input SYSCLK_50M; //System clock, 50MHz.
input RST_B; //Global reset, low active.
input PUSH_SW1; //G
//input key; //G
output [5:0] LED_DATA; //LED data output.
//===========================================================================
//Wire and reg declaration
//===========================================================================
wire SYSCLK_50M;
wire RST_B;
reg [5:0] LED_DATA;
wire PUSH_SW1;
//wire key;
//===========================================================================
//Wire and reg in the module
//===========================================================================
reg [23:0] TIME_CNT; //Count the time, everyone show 1ms.
reg [5:0] LED_DATA_N; //Next value of LED_DATA.
wire [23:0] TIME_CNT_N; //Next value of TIME_CNT.
一周热门 更多>