FreeCalypso > hg > fc-sim-sniff
annotate fpga/sniffer-basic/top.v @ 28:0f74428c177c
fpga/sniffer-pps: first version
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 29 Aug 2023 20:05:23 +0000 |
parents | e5c5162b3a8c |
children | dc99c9962aed |
rev | line source |
---|---|
6
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 module top (CLK12, LED1, LED2, LED3, LED4, LED5, UART_TxD, UART_RxD, UART_RTS, |
26
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
2 UART_CTS, UART_DTR, UART_DSR, UART_DCD, SIM_RST_in, SIM_CLK_in, |
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
3 SIM_IO_in, SIM_IO_out); |
6
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 input CLK12; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 output LED1, LED2, LED3, LED4, LED5; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 input UART_TxD, UART_RTS, UART_DTR; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 output UART_RxD, UART_CTS, UART_DSR, UART_DCD; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 |
26
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
11 input SIM_RST_in, SIM_CLK_in, SIM_IO_in; |
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
12 output SIM_IO_out; |
6
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 /* input synchronizers */ |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 wire SIM_RST_sync, SIM_CLK_sync, SIM_IO_sync; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
26
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
18 sync_inputs sync (CLK12, SIM_RST_in, SIM_RST_sync, SIM_CLK_in, SIM_CLK_sync, |
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
19 SIM_IO_in, SIM_IO_sync); |
6
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 /* character receiver */ |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 wire Rx_strobe, Rx_error; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 wire [7:0] Rx_char; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 wire Rx_start_bit, Rx_parity_bit; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 sniff_rx sniff_rx (CLK12, SIM_RST_sync, SIM_CLK_sync, SIM_IO_sync, |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 Rx_strobe, Rx_error, Rx_char, Rx_start_bit, Rx_parity_bit); |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 /* explicit detection of RST transitions */ |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 wire SIM_RST_toggle; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 reset_detect reset_detect (CLK12, SIM_RST_sync, SIM_RST_toggle); |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 /* output to the host */ |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 wire Tx_trigger; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 wire [15:0] Tx_data; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 assign Tx_trigger = Rx_strobe | SIM_RST_toggle; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 assign Tx_data = {SIM_RST_toggle,SIM_RST_sync,3'b000, |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 Rx_error,Rx_start_bit,Rx_parity_bit,Rx_char}; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 uart_tx uart_tx (CLK12, Tx_trigger, Tx_data, UART_RxD); |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 /* UART modem control outputs: unused */ |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 assign UART_CTS = 1'b1; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 assign UART_DSR = 1'b0; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 assign UART_DCD = 1'b0; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 /* board LEDs */ |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 assign LED1 = 1'b1; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 assign LED2 = 1'b0; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 assign LED3 = 1'b1; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 assign LED4 = 1'b0; |
11
3da4676dafa8
fpga/sniffer-basic/top.v: correct SIM_RST polarity for LED
Mychaela Falconia <falcon@freecalypso.org>
parents:
6
diff
changeset
|
59 assign LED5 = SIM_RST; |
6
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 |
26
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
61 /* SIM_IO_out dummy: if someone mistakenly connects an Icestick board with |
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
62 * this FPGA image in it to a cardem pod instead of the sniffing one, |
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
63 * we ensure that the 74LVC1G07 OD buffer remains off by feeding logic HIGH |
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
64 * to this buffer. |
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
65 */ |
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
66 |
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
67 assign SIM_IO_out = 1'b1; |
e5c5162b3a8c
fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents:
11
diff
changeset
|
68 |
6
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 endmodule |