FreeCalypso > hg > fc-pcm-if
annotate fpga/mcsi-rx/top.v @ 11:e93a11f44e6f
fc-mcsi-rxtx: implement basic Tx
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 28 Oct 2024 06:34:42 +0000 |
parents | b3190839cce3 |
children |
rev | line source |
---|---|
1
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * Top level Verilog module for MCSI Rx-only FPGA. |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 */ |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 module top (CLK12, LED1, LED2, LED3, LED4, LED5, UART_TxD, UART_RxD, UART_RTS, |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 UART_CTS, UART_DTR, UART_DSR, UART_DCD, MCSI_CLK, MCSI_FSYNCH, |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 MCSI_TXD, MCSI_RXD); |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 input CLK12; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 output LED1, LED2, LED3, LED4, LED5; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 input UART_TxD, UART_RTS, UART_DTR; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 output UART_RxD, UART_CTS, UART_DSR, UART_DCD; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 input MCSI_CLK, MCSI_FSYNCH, MCSI_TXD; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 output MCSI_RXD; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 /* input synchronizers */ |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 wire MCSI_CLK_sync, MCSI_FS_sync, MCSI_Din_sync; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 sync_inputs sync (CLK12, MCSI_CLK, MCSI_CLK_sync, MCSI_FSYNCH, MCSI_FS_sync, |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 MCSI_TXD, MCSI_Din_sync); |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 /* running clock detector */ |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
27 wire MCSI_CLK_running; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
28 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
29 clk_check clk_check (CLK12, MCSI_CLK_sync, MCSI_CLK_running); |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
30 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
31 /* MCSI_CLK edge detector */ |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
32 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
33 wire MCSI_CLK_negedge; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
34 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
35 clk_edge clk_edge (CLK12, MCSI_CLK_sync, MCSI_CLK_negedge); |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
36 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
37 /* MCSI Rx logic */ |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
38 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
39 wire [15:0] PCM_sample_out; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
40 wire PCM_sample_strobe; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
41 wire FS_lost, clk_fs_good; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
42 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
43 mcsi_rx mcsi_rx (CLK12, MCSI_FS_sync, MCSI_Din_sync, MCSI_CLK_negedge, |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
44 PCM_sample_out, PCM_sample_strobe, FS_lost); |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
45 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
46 assign clk_fs_good = MCSI_CLK_running && !FS_lost; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
47 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
48 /* output to the host */ |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
49 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
50 uart_tx uart_tx (CLK12, PCM_sample_strobe, PCM_sample_out, UART_RxD); |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
51 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
52 /* UART modem control outputs: unused */ |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
53 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
54 assign UART_CTS = 1'b1; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
55 assign UART_DSR = 1'b0; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
56 assign UART_DCD = 1'b0; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
57 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
58 /* board LEDs */ |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
59 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
60 assign LED1 = 1'b0; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
61 assign LED2 = 1'b1; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
62 assign LED3 = 1'b0; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
63 assign LED4 = 1'b1; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
64 assign LED5 = clk_fs_good; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
65 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
66 /* No MCSI output in this version */ |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
67 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
68 assign MCSI_RXD = 1'b0; |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
69 |
b3190839cce3
first FPGA version, MCSI Rx only
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
70 endmodule |