FreeCalypso > hg > fc-sim-sniff
annotate fpga/sniffer-basic/top.v @ 25:c03a882cc49e
doc/Sniffer-FPGA-design: update for working status
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Tue, 29 Aug 2023 06:37:58 +0000 |
parents | 3da4676dafa8 |
children | e5c5162b3a8c |
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, |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 UART_CTS, UART_DTR, UART_DSR, UART_DCD, SIM_RST, SIM_CLK, SIM_IO); |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 input CLK12; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 output LED1, LED2, LED3, LED4, LED5; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 input UART_TxD, UART_RTS, UART_DTR; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 output UART_RxD, UART_CTS, UART_DSR, UART_DCD; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 input SIM_RST, SIM_CLK, SIM_IO; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 /* input synchronizers */ |
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 wire SIM_RST_sync, SIM_CLK_sync, SIM_IO_sync; |
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 sync_inputs sync (CLK12, SIM_RST, SIM_RST_sync, SIM_CLK, SIM_CLK_sync, |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 SIM_IO, SIM_IO_sync); |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 /* character receiver */ |
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 wire Rx_strobe, Rx_error; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 wire [7:0] Rx_char; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 wire Rx_start_bit, Rx_parity_bit; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 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
|
26 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
|
27 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 /* explicit detection of RST transitions */ |
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 wire SIM_RST_toggle; |
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 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
|
33 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 /* output to the host */ |
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 wire Tx_trigger; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 wire [15:0] Tx_data; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 assign Tx_trigger = Rx_strobe | SIM_RST_toggle; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 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
|
41 Rx_error,Rx_start_bit,Rx_parity_bit,Rx_char}; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 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
|
44 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 /* UART modem control outputs: unused */ |
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 assign UART_CTS = 1'b1; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 assign UART_DSR = 1'b0; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 assign UART_DCD = 1'b0; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 /* board LEDs */ |
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 assign LED1 = 1'b1; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 assign LED2 = 1'b0; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 assign LED3 = 1'b1; |
7db5fd6646df
fpga/sniffer-basic: initial version
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 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
|
57 assign LED5 = SIM_RST; |
6
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 endmodule |