1 |
2 |
ale500 |
`timescale 1ns / 1ps
|
2 |
|
|
//////////////////////////////////////////////////////////////////////////////////
|
3 |
|
|
// Company:
|
4 |
|
|
// Engineer: R.A. Paz Schmidt
|
5 |
|
|
//
|
6 |
|
|
// Create Date: 11:12:42 12/23/2013
|
7 |
|
|
// Design Name:
|
8 |
|
|
// Module Name: CC3_top_x
|
9 |
|
|
// Project Name: MC6809/HD6309 compatible core
|
10 |
|
|
// Target Devices:
|
11 |
|
|
// Tool versions: Xilinx WebPack v 10.1 (for Spartan II)
|
12 |
|
|
// Description:
|
13 |
|
|
//
|
14 |
|
|
// Dependencies:
|
15 |
|
|
//
|
16 |
|
|
// Revision:
|
17 |
|
|
// Revision 0.01 - File Created
|
18 |
|
|
// Additional Comments: Distributed under the terms of the Lesser GPL, see LICENSE.TXT
|
19 |
|
|
//
|
20 |
|
|
//////////////////////////////////////////////////////////////////////////////////
|
21 |
|
|
module CC3_top_x(
|
22 |
|
|
input clk32_i,
|
23 |
|
|
output mem_we_n,
|
24 |
|
|
output mem_oe_n,
|
25 |
|
|
output [15:0] mem_addr_o,
|
26 |
|
|
inout [7:0] mem_data_io
|
27 |
|
|
);
|
28 |
|
|
|
29 |
|
|
wire cpu_clk;
|
30 |
|
|
wire cpu_reset_n;
|
31 |
|
|
wire cpu_nmi_n;
|
32 |
|
|
wire cpu_irq_n;
|
33 |
|
|
wire cpu_firq_n;
|
34 |
|
|
wire cpu_state_o;
|
35 |
|
|
wire cpu_we_o;
|
36 |
|
|
wire cpu_oe_o;
|
37 |
|
|
wire [15:0] cpu_addr_o;
|
38 |
|
|
wire [7:0] cpu_data_i;
|
39 |
|
|
wire [7:0] cpu_data_o;
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
assign mem_we_n = cpu_we_o;
|
43 |
|
|
assign mem_oe_n = cpu_oe_o;
|
44 |
|
|
assign mem_addr_o = cpu_addr_o;
|
45 |
|
|
assign mem_data_io = cpu_we_o ? cpu_data_o:cpu_data_i;
|
46 |
|
|
|
47 |
|
|
wire cpu_reset;
|
48 |
|
|
reg [3:0] reset_cnt;
|
49 |
|
|
|
50 |
|
|
assign cpu_reset = reset_cnt == 4'd14;
|
51 |
|
|
|
52 |
|
|
always @(posedge clk32_i)
|
53 |
|
|
begin
|
54 |
|
|
if (reset_cnt != 4'd14)
|
55 |
|
|
reset_cnt <= reset_cnt + 4'h1;
|
56 |
|
|
end
|
57 |
|
|
|
58 |
|
|
|
59 |
|
|
MC6809_cpu cpu(
|
60 |
|
|
.cpu_clk(clk32_i),
|
61 |
|
|
.cpu_reset_n(cpu_reset),
|
62 |
|
|
.cpu_nmi_n(0),
|
63 |
|
|
.cpu_irq_n(0),
|
64 |
|
|
.cpu_firq_n(0),
|
65 |
|
|
.cpu_state_o(),
|
66 |
|
|
.cpu_we_o(cpu_we_o),
|
67 |
|
|
.cpu_oe_o(cpu_oe_o),
|
68 |
|
|
.cpu_addr_o(cpu_addr_o),
|
69 |
|
|
.cpu_data_i(cpu_data_i),
|
70 |
|
|
.cpu_data_o(cpu_data_o)
|
71 |
|
|
);
|
72 |
|
|
|
73 |
|
|
|
74 |
|
|
`ifdef SPARTAN3
|
75 |
|
|
RAMB16_S9_S9 bios2k(.DOA(cpu_data_i), .DOPA(), .ADDRA(cpu_addr_o), .CLKA(clk32_i),
|
76 |
|
|
.DIA(cpu_data_o), .DIPA(), .ENA(cpu_oe_o | cpu_we_o), .SSRA(1), .WEA(cpu_we_o),
|
77 |
|
|
.DOPB(), .DOB(), .ADDRB(0), .CLKB(clk32_i), .DIB(0), .DIPB(), .ENB(0),
|
78 |
|
|
.SSRB(0), .WEB(0));
|
79 |
|
|
`else
|
80 |
|
|
RAMB4_S8 #(
|
81 |
|
|
// The following INIT_xx declarations specify the initial contents of the RAM
|
82 |
|
|
.INIT_00(256'h0000000000000000000000000000000000000000000000000000000000001086),
|
83 |
|
|
.INIT_01(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
84 |
|
|
.INIT_02(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
85 |
|
|
.INIT_03(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
86 |
|
|
.INIT_04(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
87 |
|
|
.INIT_05(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
88 |
|
|
.INIT_06(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
89 |
|
|
.INIT_07(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
90 |
|
|
.INIT_08(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
91 |
|
|
.INIT_09(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
92 |
|
|
.INIT_0A(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
93 |
|
|
.INIT_0B(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
94 |
|
|
.INIT_0C(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
95 |
|
|
.INIT_0D(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
96 |
|
|
.INIT_0E(256'h0000000000000000000000000000000000000000000000000000000000000000),
|
97 |
|
|
.INIT_0F(256'h00FF000000000000000000000000000000000000000000000000000000000000)
|
98 |
|
|
) RAMB4_S8_inst (
|
99 |
|
|
.DO(cpu_data_i), // 8-bit data output
|
100 |
|
|
.ADDR(cpu_addr_o), // 9-bit address input
|
101 |
|
|
.CLK(clk32_i), // Clock input
|
102 |
|
|
.DI(cpu_data_o), // 8-bit data input
|
103 |
|
|
.EN(cpu_oe_o | cpu_we_o), // RAM enable input
|
104 |
|
|
.RST(1'b0), // Synchronous reset input
|
105 |
|
|
.WE(cpu_we_o) // RAM write enable input
|
106 |
|
|
);
|
107 |
|
|
`endif
|
108 |
|
|
endmodule
|