1 // -----------------------------------------------------------------------
3 // Copyright 2004,2007-2009 Tommy Thorn - All Rights Reserved
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 // Bostom MA 02111-1307, USA; either version 2 of the License, or
9 // (at your option) any later version; incorporated herein by reference.
11 // -----------------------------------------------------------------------
14 `include "../../soclib/pipeconnect.h"
24 parameter FREQ
= 100_000_000; // match clock frequency
25 parameter BPS
= 9_600; // Serial speed
28 parameter ID_DC
= 2'd1;
29 parameter ID_IC
= 2'd2;
30 parameter ID_FB
= 2'd3;
32 wire clock
; // The master clock
38 // Actually, just a 1-1 clock filter for c0
39 // and a 65 MHz for video_clock
40 pll pll_inst(.inclk0(iCLK_50)
43 ,.locked(clock_locked));
44 reg iSW17_, iSW17, manual_reset;
46 assign clock
= iSYS_CLK_100
;
47 wire reset
= iSYS_RST
;
49 wire [ 7:0] rs232out_transmit_data
;
50 wire rs232out_write_enable
;
53 wire [ 7:0] rs232in_received_data
;
54 wire rs232in_received_data_valid
;
58 wire [29:0] mem_address
;
61 wire [31:0] mem_writedata
;
62 wire [3:0] mem_writedatamask
;
63 wire [31:0] mem_readdata
;
64 wire [1:0] mem_readdataid
;
66 wire yari_mem_waitrequest
;
67 wire [1:0] yari_mem_id
;
68 wire [29:0] yari_mem_address
;
71 wire [31:0] yari_mem_writedata
;
72 wire [3:0] yari_mem_writedatamask
;
82 ,.
mem_waitrequest (yari_mem_waitrequest
)
83 ,.
mem_readdata (mem_readdata
)
84 ,.
mem_readdataid (mem_readdataid
)
87 ,.
mem_id (yari_mem_id
)
88 ,.
mem_address (yari_mem_address
)
89 ,.
mem_read (yari_mem_read
)
90 ,.
mem_write (yari_mem_write
)
91 ,.
mem_writedata (yari_mem_writedata
)
92 ,.
mem_writedatamask(yari_mem_writedatamask
)
94 ,.
peripherals_req(rs232_req
)
95 ,.
peripherals_res(rs232_res
)
98 rs232out rs232out_inst
100 .
serial_out (oUART_TXD
),
101 .
transmit_data(rs232out_transmit_data
),
102 .
we (rs232out_write_enable
),
103 .
busy (rs232out_busy
));
105 defparam rs232out_inst.frequency
= FREQ
,
106 rs232out_inst.bps
= BPS
;
111 .
serial_in (iUART_RXD
),
112 .
received_data(rs232in_received_data
),
113 .
attention (rs232in_received_data_valid
));
115 defparam rs232in_inst.frequency
= FREQ
,
116 rs232in_inst.bps
= BPS
;
118 wire [31:0] vsynccnt
;
120 rs232
rs232_inst(.
clk(clock
),
126 .
rs232_req(rs232_req
),
127 .
rs232_res(rs232_res
),
129 .
rs232in_attention(rs232in_received_data_valid
),
130 .
rs232in_data (rs232in_received_data
),
132 .
rs232out_busy(rs232out_busy
),
133 .
rs232out_w (rs232out_write_enable
),
134 .
rs232out_d (rs232out_transmit_data
));
137 assign mem_id
= yari_mem_id
;
138 assign mem_address
= yari_mem_address
;
139 assign mem_read
= yari_mem_read
;
140 assign mem_write
= yari_mem_write
;
141 assign mem_writedata
= yari_mem_writedata
;
142 assign mem_writedatamask
= yari_mem_writedatamask
;
143 assign yari_mem_waitrequest
= mem_waitrequest
;