久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標題:
Tablet counting system verilog code
[打印本頁]
作者:
Vimalraj
時間:
2017-12-3 16:09
標題:
Tablet counting system verilog code
Hex keypad or tablet counting system
0.png
(11.26 KB, 下載次數: 73)
下載附件
2017-12-3 22:21 上傳
源程序如下:
//##################################################################
/*
Project/Module : Assignment
File name : HexKeyCodeGenerator.v
Version : 1-0
Date created : 25 Aug 2017
Author : Vimalraj Kasivisvanathan
Code type : Verilog
Description : Verilog code for HexKeypad
*/
//##################################################################
//`default_nettype none
module HEXKEY
#(parameter [3:0]
PRESSKEY = 4'b0001,
KEYCOL0 = 4'b0010,
KEYCOL1 = 4'b0011,
KEYCOL2 = 4'b0100,
KEYCOL3 = 4'b0101,
//DELAY1 = 4'b0110,
//DELAY2 = 4'b0111,
KEYVALID = 4'b1000,
KEYRELEASE = 4'b1001,
KEYERROR = 4'b1010)
(input b_ip_hex_sys_clock,
input b_ip_hex_sys_reset,
input b_ip_hex_clear,
input [3:0] b_ip_hex_keypad_row
output reg [3:0] b_op_hex_keycode,
output reg b_op_hex_valid_code,
output reg [3:0] b_op_hex_keypad_column,
);
reg [3:0] current,next,row;
//***********************************************************
///////////////FIRST//////////////////////////////////////
always @(posedge b_ip_hex_sys_clock) begin: BGN
if (b_ip_hex_sys_reset || b_ip_hex_clear) current <= PRESSKEY;
else current <= next;
end
//////////////////////////////////////////////////////////
///////////////////////CURRENTSTATE/////////////////////////
always @(b_ip_hex_keypad_row || current)begin: NSL
case(current)
PRESSKEY:
if ((|b_ip_hex_keypad_row)) next <= KEYCOL0;
else next <= PRESSKEY;
KEYCOL0:
if ((|b_ip_hex_keypad_row)) next = KEYVALID;
else if ((!(|b_ip_hex_keypad_row)) && b_op_hex_keypad_column == 4'b0001) next = KEYCOL1;
KEYCOL1:
if ((|b_ip_hex_keypad_row)) next = KEYVALID;
else if ((!(|b_ip_hex_keypad_row)) && b_op_hex_keypad_column == 4'b0010) next = KEYCOL2;
KEYCOL2:
if ((|b_ip_hex_keypad_row)) next = KEYVALID;
else if ((!(|b_ip_hex_keypad_row)) && b_op_hex_keypad_column == 4'b0100) next = KEYCOL3;
KEYCOL3:
if ((|b_ip_hex_keypad_row)) next = KEYVALID;
else if (!(b_ip_hex_keypad_row)) next = KEYERROR;
else next = 4'bx;
KEYVALID:
next = KEYRELEASE;
KEYRELEASE:
if (!(|b_ip_hex_keypad_row)) next = PRESSKEY;
else next = KEYRELEASE;
KEYERROR:
next = PRESSKEY;
default:
next = 4'bx;
endcase
end
/////////////////////NEXTSTATE LOGIC///////////////////////////////////////////////
always @(posedge b_ip_hex_sys_clock)begin: ROL
if (b_ip_hex_sys_reset || b_ip_hex_clear)begin
b_op_hex_keypad_column <= 4'b1111;
b_op_hex_valid_code <= 1'b0;
b_op_hex_keycode <= 4'b0000;
row <= 4'b0000;
end
else begin
case(next)
PRESSKEY:begin
b_op_hex_keypad_column <= 4'b1111;
b_op_hex_valid_code <= 1'b0;
b_op_hex_keycode <= 4'b0000;
row <= 4'b0000;
end
KEYCOL0:begin
b_op_hex_keypad_column <= 4'b0001;
b_op_hex_valid_code <= 1'b0;
row <= b_ip_hex_keypad_row;
if (row == 4'b0001) b_op_hex_keycode <= 4'b0000;
else if (row == 4'b0010) b_op_hex_keycode <= 4'b0100;
else if (row == 4'b0100) b_op_hex_keycode <= 4'b1000;
else if(row == 4'b1000) b_op_hex_keycode <= 4'b1100;
end
KEYCOL1:begin
b_op_hex_keypad_column <= 4'b0010;
b_op_hex_valid_code <= 1'b0;
row <= row;
if (row == 4'b0001) b_op_hex_keycode <= 4'b0001;
else if (row == 4'b0010) b_op_hex_keycode <= 4'b0101;
else if (row == 4'b0100) b_op_hex_keycode <= 4'b1001;
else if(row == 4'b1000) b_op_hex_keycode <= 4'b1101;
end
KEYCOL2:begin
b_op_hex_keypad_column <= 4'b0100;
b_op_hex_valid_code <= 1'b0;
row <= row;
if (row == 4'b0001) b_op_hex_keycode <= 4'b0010;
else if (row == 4'b0010) b_op_hex_keycode <= 4'b0110;
else if (row == 4'b0100) b_op_hex_keycode <= 4'b1010;
else if(row == 4'b1000) b_op_hex_keycode <= 4'b1110;
end
KEYCOL3:begin
b_op_hex_keypad_column <= 4'b1000;
b_op_hex_valid_code <= 1'b0;
row <= row;
if (row == 4'b0001) b_op_hex_keycode <= 4'b0011;
else if (row == 4'b0010) b_op_hex_keycode <= 4'b0111;
else if (row == 4'b0100) b_op_hex_keycode <= 4'b1011;
else if(row == 4'b1000) b_op_hex_keycode <= 4'b1111;
end
KEYRELEASE:begin
b_op_hex_keypad_column <= 4'b1111;
b_op_hex_valid_code <= 1'b0;
b_op_hex_keycode <= b_op_hex_keycode;
end
……………………
…………限于本文篇幅 余下代碼請從51黑下載附件…………
復制代碼
所有資料51hei提供下載:
HexKeypad.rar
(72.42 KB, 下載次數: 6)
2017-12-3 16:08 上傳
點擊文件名下載附件
hex key
下載積分: 黑幣 -5
歡迎光臨 (http://m.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
91欧美激情一区二区三区成人
|
天天久久综合
|
三级网站在线
|
午夜视频在线
|
91久久国产综合久久91精品网站
|
激情网五月天
|
一二三四区在线观看
|
男人天堂手机在线
|
成人免费视频网址
|
性视频网址
|
日韩精品三级
|
日韩综合在线
|
免费的黄色网址
|
国精产品99永久一区一区
|
亚洲乱码在线
|
色综合天天综合网国产成人网
|
97视频免费
|
欧美视频一二三区
|
国产日韩视频
|
日韩中文字幕一区二区三区
|
午夜在线免费观看
|
福利视频免费
|
日韩一级片视频
|
亚洲在线一区二区
|
特一级毛片
|
www.爱爱
|
国产成人午夜
|
水蜜桃一区二区
|
欧美激情一区
|
91免费在线看
|
九九热免费视频
|
日韩亚洲天堂
|
国产一级大片
|
亚洲欧美另类图片
|
中文字幕国产一区
|
玖玖伊人
|
午夜视频在线播放
|
亚洲丝袜视频
|
成人免费视频一区二区
|
91视频在线
|
欧美成人一级
|