annotate fpga/sniffer-pps/top.v @ 57:eb4274e7f4da

simsniff-dec: decode SELECT file IDs
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 04 Oct 2023 03:54:00 +0000
parents 737579209153
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
53
737579209153 fpga/sniffer-pps: add LED indication of running SIM CLK
Mychaela Falconia <falcon@freecalypso.org>
parents: 31
diff changeset
21 /* running clock detector */
737579209153 fpga/sniffer-pps: add LED indication of running SIM CLK
Mychaela Falconia <falcon@freecalypso.org>
parents: 31
diff changeset
22
737579209153 fpga/sniffer-pps: add LED indication of running SIM CLK
Mychaela Falconia <falcon@freecalypso.org>
parents: 31
diff changeset
23 wire SIM_CLK_running;
737579209153 fpga/sniffer-pps: add LED indication of running SIM CLK
Mychaela Falconia <falcon@freecalypso.org>
parents: 31
diff changeset
24
737579209153 fpga/sniffer-pps: add LED indication of running SIM CLK
Mychaela Falconia <falcon@freecalypso.org>
parents: 31
diff changeset
25 clk_check clk_check (CLK12, SIM_CLK_sync, SIM_CLK_running);
737579209153 fpga/sniffer-pps: add LED indication of running SIM CLK
Mychaela Falconia <falcon@freecalypso.org>
parents: 31
diff changeset
26
6
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 /* character receiver */
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 wire Rx_strobe, Rx_error;
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 wire [7:0] Rx_char;
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
31 wire Rx_start_bit, Rx_parity_bit;
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
32
31
ab37fcb71744 fpga/sniffer-pps: add actual F/D control
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
33 wire speed_enh_mode;
ab37fcb71744 fpga/sniffer-pps: add actual F/D control
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
34 wire [1:0] speed_enh_mult;
ab37fcb71744 fpga/sniffer-pps: add actual F/D control
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
35
6
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
36 sniff_rx sniff_rx (CLK12, SIM_RST_sync, SIM_CLK_sync, SIM_IO_sync,
31
ab37fcb71744 fpga/sniffer-pps: add actual F/D control
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
37 Rx_strobe, Rx_error, Rx_char, Rx_start_bit, Rx_parity_bit,
ab37fcb71744 fpga/sniffer-pps: add actual F/D control
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
38 speed_enh_mode, speed_enh_mult);
6
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
39
28
0f74428c177c fpga/sniffer-pps: first version
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
40 /* PPS catcher */
0f74428c177c fpga/sniffer-pps: first version
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
41
0f74428c177c fpga/sniffer-pps: first version
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
42 wire pos_PPS_resp_PPS1, pos_PPS_resp_PCK;
0f74428c177c fpga/sniffer-pps: first version
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
43
0f74428c177c fpga/sniffer-pps: first version
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
44 pps_catcher pps (CLK12, SIM_RST_sync, Rx_strobe, Rx_char,
0f74428c177c fpga/sniffer-pps: first version
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
45 pos_PPS_resp_PPS1, pos_PPS_resp_PCK);
0f74428c177c fpga/sniffer-pps: first version
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
46
31
ab37fcb71744 fpga/sniffer-pps: add actual F/D control
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
47 spenh_ctrl spenh (CLK12, SIM_RST_sync, Rx_strobe, Rx_char,
ab37fcb71744 fpga/sniffer-pps: add actual F/D control
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
48 pos_PPS_resp_PPS1, pos_PPS_resp_PCK,
ab37fcb71744 fpga/sniffer-pps: add actual F/D control
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
49 speed_enh_mode, speed_enh_mult);
ab37fcb71744 fpga/sniffer-pps: add actual F/D control
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
50
6
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
51 /* explicit detection of RST transitions */
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 wire SIM_RST_toggle;
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 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
56
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
57 /* output to the host */
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
58
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
59 wire Tx_trigger;
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
60 wire [15:0] Tx_data;
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
61
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
62 assign Tx_trigger = Rx_strobe | SIM_RST_toggle;
31
ab37fcb71744 fpga/sniffer-pps: add actual F/D control
Mychaela Falconia <falcon@freecalypso.org>
parents: 30
diff changeset
63 assign Tx_data = {SIM_RST_toggle,SIM_RST_sync,speed_enh_mode,
28
0f74428c177c fpga/sniffer-pps: first version
Mychaela Falconia <falcon@freecalypso.org>
parents: 26
diff changeset
64 pos_PPS_resp_PCK,pos_PPS_resp_PPS1,
6
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
65 Rx_error,Rx_start_bit,Rx_parity_bit,Rx_char};
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
66
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
67 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
68
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
69 /* UART modem control outputs: unused */
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
70
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
71 assign UART_CTS = 1'b1;
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
72 assign UART_DSR = 1'b0;
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
73 assign UART_DCD = 1'b0;
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
74
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
75 /* board LEDs */
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
76
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
77 assign LED1 = 1'b1;
53
737579209153 fpga/sniffer-pps: add LED indication of running SIM CLK
Mychaela Falconia <falcon@freecalypso.org>
parents: 31
diff changeset
78 assign LED2 = SIM_CLK_running;
6
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
79 assign LED3 = 1'b1;
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
80 assign LED4 = 1'b0;
30
dc99c9962aed fpga/sniffer-*: forgot to change SIM_RST to SIM_RST_in for LED5
Mychaela Falconia <falcon@freecalypso.org>
parents: 28
diff changeset
81 assign LED5 = SIM_RST_in;
6
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
82
26
e5c5162b3a8c fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents: 11
diff changeset
83 /* 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
84 * 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
85 * 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
86 * to this buffer.
e5c5162b3a8c fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents: 11
diff changeset
87 */
e5c5162b3a8c fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents: 11
diff changeset
88
e5c5162b3a8c fpga/sniffer-basic: drive pin 115 high for cardem pod
Mychaela Falconia <falcon@freecalypso.org>
parents: 11
diff changeset
89 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
90
6
7db5fd6646df fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
91 endmodule