1 |
4 |
sumanta.ch |
|
2 |
|
|
module DE2
|
3 |
|
|
(
|
4 |
|
|
//////////////////// Clock Input ////////////////////
|
5 |
|
|
OSC_27, // 27 MHz
|
6 |
|
|
OSC_50, // 50 MHz
|
7 |
|
|
EXT_CLOCK, // External Clock
|
8 |
|
|
//////////////////// Push Button ////////////////////
|
9 |
|
|
KEY, // Button[3:0]
|
10 |
|
|
//////////////////// DPDT Switch ////////////////////
|
11 |
|
|
DPDT_SW, // DPDT Switch[17:0]
|
12 |
|
|
//////////////////// 7-SEG Dispaly ////////////////////
|
13 |
|
|
HEX0, // Seven Segment Digital 0
|
14 |
|
|
HEX1, // Seven Segment Digital 1
|
15 |
|
|
HEX2, // Seven Segment Digital 2
|
16 |
|
|
HEX3, // Seven Segment Digital 3
|
17 |
|
|
HEX4, // Seven Segment Digital 4
|
18 |
|
|
HEX5, // Seven Segment Digital 5
|
19 |
|
|
HEX6, // Seven Segment Digital 6
|
20 |
|
|
HEX7, // Seven Segment Digital 7
|
21 |
|
|
//////////////////////// LED ////////////////////////
|
22 |
|
|
LED_GREEN, // LED Green[8:0]
|
23 |
|
|
LED_RED, // LED Red[17:0]
|
24 |
|
|
//////////////////////// UART ////////////////////////
|
25 |
|
|
UART_TXD, // UART Transmitter
|
26 |
|
|
UART_RXD, // UART Rceiver
|
27 |
|
|
TD_RESET
|
28 |
|
|
|
29 |
|
|
);
|
30 |
|
|
|
31 |
|
|
//////////////////////// Clock Input ////////////////////////
|
32 |
|
|
input OSC_27; // 27 MHz
|
33 |
|
|
input OSC_50; // 50 MHz
|
34 |
|
|
input EXT_CLOCK; // External Clock
|
35 |
|
|
//////////////////////// Push Button ////////////////////////
|
36 |
|
|
input [3:0] KEY; // Button[3:0]
|
37 |
|
|
//////////////////////// DPDT Switch ////////////////////////
|
38 |
|
|
input [17:0] DPDT_SW; // DPDT Switch[17:0]
|
39 |
|
|
//////////////////////// 7-SEG Dispaly ////////////////////////
|
40 |
|
|
output [6:0] HEX0; // Seven Segment Digital 0
|
41 |
|
|
output [6:0] HEX1; // Seven Segment Digital 1
|
42 |
|
|
output [6:0] HEX2; // Seven Segment Digital 2
|
43 |
|
|
output [6:0] HEX3; // Seven Segment Digital 3
|
44 |
|
|
output [6:0] HEX4; // Seven Segment Digital 4
|
45 |
|
|
output [6:0] HEX5; // Seven Segment Digital 5
|
46 |
|
|
output [6:0] HEX6; // Seven Segment Digital 6
|
47 |
|
|
output [6:0] HEX7; // Seven Segment Digital 7
|
48 |
|
|
//////////////////////////// LED ////////////////////////////
|
49 |
|
|
output [8:0] LED_GREEN; // LED Green[8:0]
|
50 |
|
|
output [17:0] LED_RED; // LED Red[17:0]
|
51 |
|
|
//////////////////////////// UART ////////////////////////////
|
52 |
|
|
output UART_TXD; // UART Transmitter
|
53 |
|
|
input UART_RXD; // UART Rceiver
|
54 |
|
|
output TD_RESET;
|
55 |
|
|
// USB JTAG
|
56 |
|
|
wire [7:0] mRXD_DATA,mTXD_DATA;
|
57 |
|
|
wire mRXD_Ready,mTXD_Done,mTXD_Start;
|
58 |
|
|
wire mTCK;
|
59 |
|
|
// SEG7
|
60 |
|
|
wire [31:0] mSEG7_DIG;
|
61 |
|
|
// AI
|
62 |
|
|
wire [63:0] DATA_from_AI,DATA_to_AI;
|
63 |
|
|
wire mAI_Start,mAI_Done;
|
64 |
|
|
wire [7:0] mCOLOR;
|
65 |
|
|
|
66 |
|
|
assign TD_RESET = 1'b1;
|
67 |
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
|
|
SEG7_LUT_8 u0 ( HEX0,HEX1,HEX2,HEX3,HEX4,HEX5,HEX6,HEX7,mSEG7_DIG );
|
72 |
|
|
|
73 |
|
|
wire mTXD_Done_not;
|
74 |
|
|
RS232_Controller u1_bis( .iDATA(mTXD_DATA),.iTxD_Start(mTXD_Start),.oTxD_Busy(mTXD_Done_not),
|
75 |
|
|
.oDATA(mRXD_DATA),.oRxD_Ready(mRXD_Ready),.iCLK(OSC_50),.RST_n(KEY[0]),
|
76 |
|
|
.oTxD(UART_TXD),.iRxD(UART_RXD));
|
77 |
|
|
assign mTXD_Done = !mTXD_Done_not;
|
78 |
|
|
assign LED_RED[9] = mTXD_Done_not;
|
79 |
|
|
assign LED_RED[10] = ~mAI_Done;
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
assign UART_RXD_JP1_7 = UART_RXD;
|
84 |
|
|
assign UART_TXD_JP1_50 = UART_TXD;
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
CMD_Decode u5 ( // USB JTAG
|
88 |
|
|
.iRXD_DATA(mRXD_DATA),.iRXD_Ready(mRXD_Ready),
|
89 |
|
|
.oTXD_DATA(mTXD_DATA),.oTXD_Start(mTXD_Start),.iTXD_Done(mTXD_Done),
|
90 |
|
|
// Control
|
91 |
|
|
.iCLK(OSC_50),.iRST_n(KEY[0]), .oAI_RSTn(mAI_RSTn),
|
92 |
|
|
//AI
|
93 |
|
|
.oAI_DATA(DATA_to_AI),
|
94 |
|
|
.iAI_DATA(DATA_from_AI),
|
95 |
|
|
.oAI_Start(mAI_Start),
|
96 |
|
|
.iAI_Done(mAI_Done),.oCOLOR(mCOLOR),.d_cmd(CMD_Tmp[16:0]) );
|
97 |
|
|
AI inst_AI (
|
98 |
|
|
.oAI_DATA(DATA_from_AI),
|
99 |
|
|
.iAI_DATA(DATA_to_AI),
|
100 |
|
|
.iCOLOR(mCOLOR),
|
101 |
|
|
.imovecount(CMD_Tmp[16:0]),
|
102 |
|
|
.iAI_Start(mAI_Start),
|
103 |
|
|
.oAI_Done(mAI_Done),
|
104 |
|
|
|
105 |
|
|
// Control
|
106 |
|
|
.iCLK(OSC_50),.iRST_n(mAI_RSTn) );
|
107 |
|
|
wire [63:0] CMD_Tmp;
|
108 |
|
|
|
109 |
|
|
//assign mSEG7_DIG = { CMD_Tmp[31:28],CMD_Tmp[27:24],CMD_Tmp[23:20],CMD_Tmp[19:16],
|
110 |
|
|
// CMD_Tmp[15:12],CMD_Tmp[11:8],CMD_Tmp[7:4],CMD_Tmp[3:0] };
|
111 |
|
|
assign mSEG7_DIG = {
|
112 |
|
|
DATA_to_AI[63:60],DATA_to_AI[59:56],DATA_to_AI[55:52],DATA_to_AI[51:48],
|
113 |
|
|
DATA_to_AI[47:44],DATA_to_AI[43:40],DATA_to_AI[39:36],DATA_to_AI[35:32] }
|
114 |
|
|
// DATA_from_AI[31:28],DATA_from_AI[27:24],DATA_from_AI[23:20],DATA_from_AI[19:16],
|
115 |
|
|
// DATA_from_AI[15:12],DATA_from_AI[11:8],DATA_from_AI[7:4],DATA_from_AI[3:0] }
|
116 |
|
|
;
|
117 |
|
|
|
118 |
|
|
|
119 |
|
|
endmodule
|