1 |
17 |
sumanta.ch |
|
2 |
|
|
module DE2
|
3 |
|
|
(
|
4 |
|
|
//////////////////// Clock Input ////////////////////
|
5 |
|
|
//OSC_27, // 27 MHz
|
6 |
|
|
//OSC_50, // 50 MHz
|
7 |
|
|
|
8 |
|
|
// Master clock input (muxed from many sources)
|
9 |
|
|
SYSCLK_P, SYSCLK_N,
|
10 |
|
|
EXT_CLOCK, // External Clock
|
11 |
|
|
//////////////////// Push Button ////////////////////
|
12 |
|
|
KEY, // Button[3:0]
|
13 |
|
|
//////////////////// DPDT Switch ////////////////////
|
14 |
|
|
DPDT_SW, // DPDT Switch[17:0]
|
15 |
|
|
//////////////////// 7-SEG Dispaly ////////////////////
|
16 |
|
|
HEX0, // Seven Segment Digital 0
|
17 |
|
|
HEX1, // Seven Segment Digital 1
|
18 |
|
|
HEX2, // Seven Segment Digital 2
|
19 |
|
|
HEX3, // Seven Segment Digital 3
|
20 |
|
|
HEX4, // Seven Segment Digital 4
|
21 |
|
|
HEX5, // Seven Segment Digital 5
|
22 |
|
|
HEX6, // Seven Segment Digital 6
|
23 |
|
|
HEX7, // Seven Segment Digital 7
|
24 |
|
|
//////////////////////// LED ////////////////////////
|
25 |
|
|
LED_GREEN, // LED Green[8:0]
|
26 |
|
|
LED_RED, // LED Red[17:0]
|
27 |
|
|
//////////////////////// UART ////////////////////////
|
28 |
|
|
UART_TXD, // UART Transmitter
|
29 |
|
|
UART_RXD, // UART Rceiver
|
30 |
|
|
TD_RESET
|
31 |
|
|
|
32 |
|
|
);
|
33 |
|
|
|
34 |
|
|
//////////////////////// Clock Input ////////////////////////
|
35 |
|
|
//input OSC_27; // 27 MHz
|
36 |
|
|
//input OSC_50; // 50 MHz
|
37 |
|
|
input SYSCLK_P, SYSCLK_N;
|
38 |
|
|
input EXT_CLOCK; // External Clock
|
39 |
|
|
//////////////////////// Push Button ////////////////////////
|
40 |
|
|
input [3:0] KEY; // Button[3:0]
|
41 |
|
|
//////////////////////// DPDT Switch ////////////////////////
|
42 |
|
|
input [17:0] DPDT_SW; // DPDT Switch[17:0]
|
43 |
|
|
//////////////////////// 7-SEG Dispaly ////////////////////////
|
44 |
|
|
output [6:0] HEX0; // Seven Segment Digital 0
|
45 |
|
|
output [6:0] HEX1; // Seven Segment Digital 1
|
46 |
|
|
output [6:0] HEX2; // Seven Segment Digital 2
|
47 |
|
|
output [6:0] HEX3; // Seven Segment Digital 3
|
48 |
|
|
output [6:0] HEX4; // Seven Segment Digital 4
|
49 |
|
|
output [6:0] HEX5; // Seven Segment Digital 5
|
50 |
|
|
output [6:0] HEX6; // Seven Segment Digital 6
|
51 |
|
|
output [6:0] HEX7; // Seven Segment Digital 7
|
52 |
|
|
//////////////////////////// LED ////////////////////////////
|
53 |
|
|
output [8:0] LED_GREEN; // LED Green[8:0]
|
54 |
|
|
output [17:0] LED_RED; // LED Red[17:0]
|
55 |
|
|
//////////////////////////// UART ////////////////////////////
|
56 |
|
|
output UART_TXD; // UART Transmitter
|
57 |
|
|
input UART_RXD; // UART Rceiver
|
58 |
|
|
output TD_RESET;
|
59 |
|
|
// USB JTAG
|
60 |
|
|
wire [7:0] mRXD_DATA,mTXD_DATA;
|
61 |
|
|
wire mRXD_Ready,mTXD_Done,mTXD_Start;
|
62 |
|
|
wire mTCK;
|
63 |
|
|
// SEG7
|
64 |
|
|
wire [31:0] mSEG7_DIG;
|
65 |
|
|
// AI
|
66 |
|
|
wire [63:0] DATA_from_AI,DATA_to_AI;
|
67 |
|
|
wire mAI_Start,mAI_Done;
|
68 |
|
|
wire [7:0] mCOLOR;
|
69 |
|
|
|
70 |
|
|
//------- Clocks -------
|
71 |
|
|
wire clk200, clk20, clk50, proc_clk, clk125; // GCLK's
|
72 |
|
|
wire mcbclk_2x_0, mcbclk_2x_180, mcbclk_pll_lock, calib_clk; // MCB sigs
|
73 |
|
|
wire clk125_rx; // receive clock from PHY
|
74 |
|
|
wire clk125_rx_bufio;
|
75 |
|
|
wire PHY_RXCLK;
|
76 |
|
|
assign clk50=calib_clk;
|
77 |
|
|
|
78 |
|
|
SP605_BRD_CLOCKS //#(.PROC_CLK_FREQ(proc_clk_freq))
|
79 |
|
|
clocks (
|
80 |
|
|
.SYSCLK_P(SYSCLK_P), .SYSCLK_N(SYSCLK_N),
|
81 |
|
|
.CLK20(clk20),
|
82 |
|
|
.CLK200(clk200),
|
83 |
|
|
.CLK125(clk125),
|
84 |
|
|
.PROC_CLK(proc_clk),
|
85 |
|
|
.MCBCLK_2X_0(mcbclk_2x_0), .MCBCLK_2X_180(mcbclk_2x_180), .MCBCLK_PLL_LOCK(mcbclk_pll_lock), .CALIB_CLK(calib_clk),
|
86 |
|
|
.PHY_RXCLK(PHY_RXCLK), .CLK125_RX(clk125_rx), .CLK125_RX_BUFIO(clk125_rx_bufio),
|
87 |
|
|
.RST(KEY[0])
|
88 |
|
|
);
|
89 |
|
|
wire OSC_27; // 27 MHz
|
90 |
|
|
wire OSC_50; // 50 MHz
|
91 |
|
|
assign OSC_50 =clk20;
|
92 |
|
|
//------- Clocks -------
|
93 |
|
|
assign TD_RESET = 1'b1;
|
94 |
|
|
|
95 |
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
|
|
SEG7_LUT_8 u0 ( HEX0,HEX1,HEX2,HEX3,HEX4,HEX5,HEX6,HEX7,mSEG7_DIG );
|
99 |
|
|
|
100 |
|
|
wire mTXD_Done_not;
|
101 |
|
|
RS232_Controller u1_bis( .iDATA(mTXD_DATA),.iTxD_Start(mTXD_Start),.oTxD_Busy(mTXD_Done_not),
|
102 |
|
|
.oDATA(mRXD_DATA),.oRxD_Ready(mRXD_Ready),.iCLK(OSC_50),.RST_n(KEY[0]),
|
103 |
|
|
.oTxD(UART_TXD),.iRxD(UART_RXD));
|
104 |
|
|
//RS232_Controller u1_bis( .iDATA(8'b00101011),.iTxD_Start(1'b1),.oTxD_Busy(mTXD_Done_not),
|
105 |
|
|
// .oDATA(mRXD_DATA),.oRxD_Ready(mRXD_Ready),.iCLK(OSC_50),.RST_n(KEY[0]),
|
106 |
|
|
// .oTxD(UART_TXD),.iRxD(UART_RXD));
|
107 |
|
|
assign mTXD_Done = !mTXD_Done_not;
|
108 |
|
|
assign LED_RED[9] = mTXD_Done_not;
|
109 |
|
|
|
110 |
|
|
//assign LED_RED[10] = ~mAI_Done;
|
111 |
|
|
assign LED_RED[10]=~UART_RXD;
|
112 |
|
|
assign LED_RED[11]=~UART_TXD;
|
113 |
|
|
assign LED_RED[12]=KEY[0];
|
114 |
|
|
//assign mRXD_DATA=LED_RED[12];
|
115 |
|
|
|
116 |
|
|
wire rst=!(KEY[0]);
|
117 |
|
|
|
118 |
|
|
assign UART_RXD_JP1_7 = UART_RXD;
|
119 |
|
|
assign UART_TXD_JP1_50 = UART_TXD;
|
120 |
|
|
|
121 |
|
|
wire [63:0] CMD_Tmp;
|
122 |
|
|
|
123 |
|
|
CMD_Decode u5 ( // USB JTAG
|
124 |
|
|
.iRXD_DATA(mRXD_DATA),.iRXD_Ready(mRXD_Ready),
|
125 |
|
|
.oTXD_DATA(mTXD_DATA),.oTXD_Start(mTXD_Start),.iTXD_Done(mTXD_Done),
|
126 |
|
|
// Control
|
127 |
|
|
.iCLK(OSC_50),.iRST_n(rst), .oAI_RSTn(mAI_RSTn),
|
128 |
|
|
//AI
|
129 |
|
|
.oAI_DATA(DATA_to_AI),
|
130 |
|
|
.iAI_DATA(DATA_from_AI),
|
131 |
|
|
.oAI_Start(mAI_Start),
|
132 |
|
|
.iAI_Done(mAI_Done),.oCOLOR(mCOLOR),.d_cmd(CMD_Tmp[16:0]) );
|
133 |
|
|
|
134 |
|
|
//CMD_Decode u5 ( // USB JTAG
|
135 |
|
|
// .iRXD_DATA(mRXD_DATA),.iRXD_Ready(mRXD_Ready),
|
136 |
|
|
// .oTXD_DATA(mTXD_DATA),.oTXD_Start(mTXD_Start),.iTXD_Done(mTXD_Done),
|
137 |
|
|
// // Control
|
138 |
|
|
// .iCLK(OSC_50),.iRST_n(rst), .oAI_RSTn(mAI_RSTn),
|
139 |
|
|
// //AI
|
140 |
|
|
// .oAI_DATA(DATA_to_AI),
|
141 |
|
|
// .iAI_DATA(DATA_from_AI),
|
142 |
|
|
// .oAI_Start(mAI_Start),
|
143 |
|
|
// .iAI_Done(KEY[1]),.oCOLOR(mCOLOR),.d_cmd(CMD_Tmp[16:0]) );
|
144 |
|
|
AI inst_AI (
|
145 |
|
|
.oAI_DATA(DATA_from_AI),
|
146 |
|
|
.iAI_DATA(DATA_to_AI),
|
147 |
|
|
.iCOLOR(mCOLOR),
|
148 |
|
|
.imovecount(CMD_Tmp[16:0]),
|
149 |
|
|
.iAI_Start(mAI_Start),
|
150 |
|
|
.oAI_Done(mAI_Done),
|
151 |
|
|
|
152 |
|
|
// Control
|
153 |
|
|
.iCLK(OSC_50),.iRST_n(mAI_RSTn) );
|
154 |
|
|
|
155 |
|
|
//assign mSEG7_DIG = { CMD_Tmp[31:28],CMD_Tmp[27:24],CMD_Tmp[23:20],CMD_Tmp[19:16],
|
156 |
|
|
// CMD_Tmp[15:12],CMD_Tmp[11:8],CMD_Tmp[7:4],CMD_Tmp[3:0] };
|
157 |
|
|
assign mSEG7_DIG = {
|
158 |
|
|
// DATA_to_AI[63:60],DATA_to_AI[59:56],DATA_to_AI[55:52],DATA_to_AI[51:48],
|
159 |
|
|
// DATA_to_AI[47:44],DATA_to_AI[43:40],DATA_to_AI[39:36],DATA_to_AI[35:32] }
|
160 |
|
|
DATA_from_AI[31:28],DATA_from_AI[27:24],DATA_from_AI[23:20],DATA_from_AI[19:16],
|
161 |
|
|
DATA_from_AI[15:12],DATA_from_AI[11:8],DATA_from_AI[7:4],DATA_from_AI[3:0] }
|
162 |
|
|
;
|
163 |
|
|
endmodule
|