@@ -10,30 +10,44 @@ module Top(
1010 output [ 2 : 0 ] rgb1,
1111 output [ 2 : 0 ] rgb2,
1212 output [ 7 : 0 ] num_csn,
13- output [ 7 : 0 ] num_an
13+ output [ 7 : 0 ] num_an,
14+ output UART_TXD
1415);
1516 logic aresetn;
1617 logic step;
1718
18- logic [31 : 0 ] chip_debug_out0;
19- logic [31 : 0 ] chip_debug_out1;
20- logic [31 : 0 ] chip_debug_out2;
21- logic [31 : 0 ] chip_debug_out3;
19+ logic [63 : 0 ] chip_debug_out0;
20+ logic [63 : 0 ] chip_debug_out1;
21+ logic [63 : 0 ] chip_debug_out2;
22+ logic [63 : 0 ] chip_debug_out3;
23+
24+ logic [7 : 0 ] uart_data, sim_uart_char;
25+ logic uart_send, uart_ready, sim_uart_char_valid;
26+ logic [31 : 0 ] clk_div;
27+ logic clk_cpu;
28+
29+ always @ (posedge clk) begin
30+ if (! resetn) clk_div <= 0 ;
31+ else clk_div <= clk_div + 1 ;
32+ end
33+ assign clk_cpu = clk_div[3 ];
2234
2335 Core chip_inst (
24- .clk (clk ),
36+ .clk (clk_cpu ),
2537 .aresetn (aresetn),
2638 .step (step),
2739 .debug_mode (switch[15 ]),
2840 .debug_reg_addr (switch[11 : 7 ]),
2941 .chip_debug_out0 (chip_debug_out0),
3042 .chip_debug_out1 (chip_debug_out1),
3143 .chip_debug_out2 (chip_debug_out2),
32- .chip_debug_out3 (chip_debug_out3)
44+ .chip_debug_out3 (chip_debug_out3),
45+ .sim_uart_char_out (sim_uart_char),
46+ .sim_uart_char_valid (sim_uart_char_valid),
3347 );
3448
3549 IO_Manager io_manager_inst (
36- .clk (clk ),
50+ .clk (clk_cpu ),
3751 .resetn (resetn),
3852
3953 // to chip
@@ -54,9 +68,27 @@ module Top(
5468 .debug1 ({ 16'b0 , switch[15 : 0 ]} ),
5569 .debug2 ({ 12'b0 , 3'b0 , button[4 ], 3'b0 , button[3 ], 3'b0 , button[2 ], 3'b0 , button[1 ], 3'b0 , button[0 ]} ),
5670 .debug3 (32'h12345678 ),
57- .debug4 (chip_debug_out0),
58- .debug5 (chip_debug_out1),
59- .debug6 (chip_debug_out2),
60- .debug7 (chip_debug_out3)
71+ .debug4 (chip_debug_out0[31 : 0 ]),
72+ .debug5 (chip_debug_out1[31 : 0 ]),
73+ .debug6 (chip_debug_out2[31 : 0 ]),
74+ .debug7 (chip_debug_out3[31 : 0 ])
75+ );
76+
77+ UART_TX_CTRL uart_tx_ctrl (
78+ .SEND (uart_send),
79+ .DATA (uart_data),
80+ .CLK (clk),
81+ .READY (uart_ready),
82+ .UART_TX (UART_TXD )
83+ );
84+
85+ uart_buffer UART_BUFF (
86+ .clk (clk_cpu),
87+ .rst (~ aresetn),
88+ .ready (uart_ready),
89+ .sim_uart_char_valid (sim_uart_char_valid),
90+ .sim_uart_char (sim_uart_char),
91+ .send (uart_send),
92+ .datao (uart_data)
6193 );
6294endmodule
0 commit comments