1 // -----------------------------------------------------------------------
3 // Copyright 2004,2007 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 // -----------------------------------------------------------------------
17 4000_0000 - 400F_FFFF Extern SRAM (1 MiB)
18 BFC0_0000 - BFC0_3FFF Boot ROM (16 KiB) (Preloaded I$ cache)
19 FF00_0000 - FF00_1FFF Peripherals
21 0 rs232out busy rs232out data
28 `include "../../soclib/pipeconnect.h"
48 output wire [17:0] rama_a
,
49 inout wire [15:0] rama_d
,
55 output wire [17:0] ramb_a
,
56 inout wire [15:0] ramb_d
,
61 output wire ramb_nwe
);
65 pll
pll(.
inclk0(clk
), // 20 MHz on Cycore
66 .
c0(clock
), // xx MHz output
69 assign wd
= rst_counter
[22];
71 reg [26:0] rst_counter
= 0;
72 always @(posedge clock
)
74 // rst_counter <= 'd48_000_000;
75 // else if (~rst_counter[26])
77 rst_counter
<= rst_counter
- 1;
79 wire rst
= ~rst_counter
[26];
81 assign ramb_a
= rama_a
;
82 assign ramb_ncs
= rama_ncs
;
83 assign ramb_noe
= rama_noe
;
84 assign ramb_nwe
= rama_nwe
;
89 parameter FREQ
= 40_000_000; // match clock frequency
90 parameter BPS
= 115_200; // Serial speed
92 wire [ 7:0] rs232out_d
;
96 wire [ 7:0] rs232in_data
;
97 wire rs232in_attention
;
101 wire [29:0] mem_address
;
104 wire [31:0] mem_writedata
;
105 wire [3:0] mem_writedatamask
;
106 wire [31:0] mem_readdata
;
107 wire [1:0] mem_readdataid
;
116 ,.
mem_waitrequest(mem_waitrequest
)
118 ,.
mem_address(mem_address
)
120 ,.
mem_write(mem_write
)
121 ,.
mem_writedata(mem_writedata
)
122 ,.
mem_writedatamask(mem_writedatamask
)
123 ,.
mem_readdata(mem_readdata
)
124 ,.
mem_readdataid(mem_readdataid
)
126 ,.
peripherals_req(rs232_req
)
127 ,.
peripherals_res(rs232_res
)
133 ,.
mem_waitrequest(mem_waitrequest
)
135 ,.
mem_address(mem_address
)
137 ,.
mem_write(mem_write
)
138 ,.
mem_writedata(mem_writedata
)
139 ,.
mem_writedatamask(mem_writedatamask
)
140 ,.
mem_readdata(mem_readdata
)
141 ,.
mem_readdataid(mem_readdataid
)
144 ,.
sram_d({rama_d
,ramb_d
})
145 ,.
sram_cs_n(rama_ncs
)
146 ,.
sram_be_n({rama_nub
,rama_nlb
,ramb_nub
,ramb_nlb
})
147 ,.
sram_oe_n(rama_noe
)
148 ,.
sram_we_n(rama_nwe
)
152 rs232out_inst(.
clk25MHz(clock
),
155 .
serial_out(ser_txd
),
156 .
transmit_data(rs232out_d
),
158 .
busy(rs232out_busy
));
161 rs232in_inst(.
clk25MHz(clock
),
165 .
received_data(rs232in_data
),
166 .
attention(rs232in_attention
));
168 rs232
rs232_inst(.
clk(clock
),
171 .
rs232_req(rs232_req
),
172 .
rs232_res(rs232_res
),
174 .
rs232in_attention(rs232in_attention
),
175 .
rs232in_data(rs232in_data
),
177 .
rs232out_busy(rs232out_busy
),
178 .
rs232out_w(rs232out_w
),
179 .
rs232out_d(rs232out_d
));