1 |
34 |
ultra_embe |
//-----------------------------------------------------------------
|
2 |
|
|
// AltOR32
|
3 |
|
|
// Alternative Lightweight OpenRisc
|
4 |
36 |
ultra_embe |
// V2.1
|
5 |
34 |
ultra_embe |
// Ultra-Embedded.com
|
6 |
36 |
ultra_embe |
// Copyright 2011 - 2014
|
7 |
34 |
ultra_embe |
//
|
8 |
|
|
// Email: admin@ultra-embedded.com
|
9 |
|
|
//
|
10 |
|
|
// License: LGPL
|
11 |
|
|
//-----------------------------------------------------------------
|
12 |
|
|
//
|
13 |
37 |
ultra_embe |
// Copyright (C) 2011 - 2014 Ultra-Embedded.com
|
14 |
34 |
ultra_embe |
//
|
15 |
|
|
// This source file may be used and distributed without
|
16 |
|
|
// restriction provided that this copyright statement is not
|
17 |
|
|
// removed from the file and that any derivative work contains
|
18 |
|
|
// the original copyright notice and the associated disclaimer.
|
19 |
|
|
//
|
20 |
|
|
// This source file is free software; you can redistribute it
|
21 |
|
|
// and/or modify it under the terms of the GNU Lesser General
|
22 |
|
|
// Public License as published by the Free Software Foundation;
|
23 |
|
|
// either version 2.1 of the License, or (at your option) any
|
24 |
|
|
// later version.
|
25 |
|
|
//
|
26 |
|
|
// This source is distributed in the hope that it will be
|
27 |
|
|
// useful, but WITHOUT ANY WARRANTY; without even the implied
|
28 |
|
|
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
29 |
|
|
// PURPOSE. See the GNU Lesser General Public License for more
|
30 |
|
|
// details.
|
31 |
|
|
//
|
32 |
|
|
// You should have received a copy of the GNU Lesser General
|
33 |
|
|
// Public License along with this source; if not, write to the
|
34 |
|
|
// Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
35 |
|
|
// Boston, MA 02111-1307 USA
|
36 |
|
|
//-----------------------------------------------------------------
|
37 |
|
|
|
38 |
|
|
//-----------------------------------------------------------------
|
39 |
|
|
// Module - Simple AltOR32 (wrapper for cutdown core)
|
40 |
|
|
//-----------------------------------------------------------------
|
41 |
|
|
module cpu
|
42 |
|
|
(
|
43 |
|
|
// General
|
44 |
|
|
input clk_i /*verilator public*/,
|
45 |
|
|
input rst_i /*verilator public*/,
|
46 |
|
|
|
47 |
|
|
// Maskable interrupt
|
48 |
|
|
input intr_i /*verilator public*/,
|
49 |
|
|
|
50 |
|
|
// Unmaskable interrupt
|
51 |
|
|
input nmi_i /*verilator public*/,
|
52 |
|
|
|
53 |
|
|
// Fault
|
54 |
|
|
output fault_o /*verilator public*/,
|
55 |
|
|
|
56 |
|
|
// Breakpoint / Trap
|
57 |
|
|
output break_o /*verilator public*/,
|
58 |
|
|
|
59 |
|
|
// Instruction memory (unused)
|
60 |
|
|
output [31:0] imem_addr_o /*verilator public*/,
|
61 |
|
|
input [31:0] imem_dat_i /*verilator public*/,
|
62 |
|
|
output [2:0] imem_cti_o /*verilator public*/,
|
63 |
|
|
output imem_cyc_o /*verilator public*/,
|
64 |
|
|
output imem_stb_o /*verilator public*/,
|
65 |
|
|
input imem_stall_i/*verilator public*/,
|
66 |
|
|
input imem_ack_i/*verilator public*/,
|
67 |
|
|
|
68 |
|
|
// Memory interface
|
69 |
|
|
output [31:0] dmem_addr_o /*verilator public*/,
|
70 |
|
|
input [31:0] dmem_dat_i /*verilator public*/,
|
71 |
|
|
output [31:0] dmem_dat_o /*verilator public*/,
|
72 |
|
|
output [2:0] dmem_cti_o /*verilator public*/,
|
73 |
|
|
output dmem_cyc_o /*verilator public*/,
|
74 |
|
|
output dmem_stb_o /*verilator public*/,
|
75 |
|
|
output dmem_we_o /*verilator public*/,
|
76 |
|
|
output [3:0] dmem_sel_o /*verilator public*/,
|
77 |
|
|
input dmem_stall_i/*verilator public*/,
|
78 |
|
|
input dmem_ack_i/*verilator public*/
|
79 |
|
|
);
|
80 |
|
|
|
81 |
|
|
//-----------------------------------------------------------------
|
82 |
|
|
// Params
|
83 |
|
|
//-----------------------------------------------------------------
|
84 |
|
|
parameter BOOT_VECTOR = 32'h00000000;
|
85 |
|
|
parameter ISR_VECTOR = 32'h00000000;
|
86 |
|
|
parameter REGISTER_FILE_TYPE = "SIMULATION";
|
87 |
|
|
parameter ENABLE_ICACHE = "DISABLED"; // Unused
|
88 |
|
|
parameter ENABLE_DCACHE = "DISABLED"; // Unused
|
89 |
|
|
parameter SUPPORT_32REGS = "ENABLED";
|
90 |
|
|
|
91 |
|
|
//-----------------------------------------------------------------
|
92 |
|
|
// Instantiation
|
93 |
|
|
//-----------------------------------------------------------------
|
94 |
|
|
// CPU
|
95 |
|
|
altor32_lite
|
96 |
|
|
#(
|
97 |
|
|
.BOOT_VECTOR(BOOT_VECTOR),
|
98 |
|
|
.ISR_VECTOR(ISR_VECTOR),
|
99 |
|
|
.REGISTER_FILE_TYPE(REGISTER_FILE_TYPE)
|
100 |
|
|
)
|
101 |
|
|
u_exec
|
102 |
|
|
(
|
103 |
|
|
// General - clocking & reset
|
104 |
|
|
.clk_i(clk_i),
|
105 |
|
|
.rst_i(rst_i),
|
106 |
|
|
.fault_o(fault_o),
|
107 |
|
|
.break_o(break_o),
|
108 |
|
|
.nmi_i(nmi_i),
|
109 |
|
|
.intr_i(intr_i),
|
110 |
|
|
.enable_i(1'b1),
|
111 |
|
|
|
112 |
|
|
.mem_addr_o(dmem_addr_o),
|
113 |
|
|
.mem_dat_o(dmem_dat_o),
|
114 |
|
|
.mem_dat_i(dmem_dat_i),
|
115 |
|
|
.mem_sel_o(dmem_sel_o),
|
116 |
|
|
.mem_cti_o(dmem_cti_o),
|
117 |
|
|
.mem_cyc_o(dmem_cyc_o),
|
118 |
|
|
.mem_we_o(dmem_we_o),
|
119 |
|
|
.mem_stb_o(dmem_stb_o),
|
120 |
|
|
.mem_stall_i(dmem_stall_i),
|
121 |
|
|
.mem_ack_i(dmem_ack_i)
|
122 |
|
|
);
|
123 |
|
|
|
124 |
|
|
// Unused outputs
|
125 |
|
|
assign imem_addr_o = 32'b0;
|
126 |
|
|
assign imem_cti_o = 3'b0;
|
127 |
|
|
assign imem_cyc_o = 1'b0;
|
128 |
|
|
assign imem_stb_o = 1'b0;
|
129 |
|
|
|
130 |
|
|
endmodule
|