OpenCores
URL https://opencores.org/ocsvn/m1_core/m1_core/trunk

Subversion Repositories m1_core

[/] [m1_core/] [trunk/] [hdl/] [rtl/] [m1_core/] [m1_core.v] - Blame information for rev 64

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 fafa1971
/*
2 64 albert.wat
 * M1 Core Top-Level
3 33 fafa1971
 *
4
 * Schematic with instances of CPU, ALU, Mul, Div and MMU
5 2 fafa1971
 */
6
 
7
module m1_core (
8 33 fafa1971
 
9
    // System
10
    input sys_clock_i,                            // System clock
11
    input sys_reset_i,                            // System reset
12
    input sys_irq_i,                              // Interrupt Request
13
 
14
    // Wishbone master interface
15
    output wb_cyc_o,                              // WB Cycle
16
    output wb_stb_o,                              // WB Strobe
17
    output wb_we_o,                               // WB Write Enable
18
    output[31:0] wb_adr_o,                        // WB Address
19
    output[31:0] wb_dat_o,                        // WB Data Out
20
    output[3:0] wb_sel_o,                         // WB Byte Select
21
    input wb_ack_i,                               // WB Ack
22
    input[31:0] wb_dat_i                          // WB Data In
23
 
24 2 fafa1971
  );
25
 
26 33 fafa1971
  /*
27
   * Wires
28
   */
29
 
30
  // ALU
31
  wire[31:0] alu_a;
32
  wire[31:0] alu_b;
33
  wire[4:0] alu_func;
34
  wire alu_signed;
35 48 fafa1971
  wire[32:0] alu_result;
36 33 fafa1971
 
37
  // Multiplier
38
  wire mul_req;
39
  wire[31:0] mul_a;
40
  wire[31:0] mul_b;
41
  wire mul_signed;
42
  wire mul_ack;
43
  wire[63:0] mul_product;
44
 
45
  // Divider
46
  wire div_req;
47
  wire[31:0] div_a;
48
  wire[31:0] div_b;
49
  wire div_signed;
50
  wire div_ack;
51
  wire[31:0] div_quotient;
52
  wire[31:0] div_remainder;
53
 
54
  // Instruction Memory
55
  wire imem_read;
56
  wire[31:0] imem_addr;
57
  wire imem_done;
58
  wire[31:0] imem_data;
59
 
60
  // Data Memory
61
  wire dmem_read;
62
  wire dmem_write;
63
  wire[31:0] dmem_addr;
64
  wire[31:0] dmem_data_w;
65 2 fafa1971
  wire[3:0] dmem_sel;
66 33 fafa1971
  wire dmem_done;
67
  wire[31:0] dmem_data_r;
68 2 fafa1971
 
69 33 fafa1971
  /*
70
   * Module instances
71
   */
72
 
73
  // CPU
74
  m1_cpu m1_cpu_0 (
75
 
76
    // System
77
    .sys_clock_i(sys_clock_i),
78
    .sys_reset_i(sys_reset_i),
79
    .sys_irq_i(sys_irq_i),
80
 
81
    // ALU
82
    .alu_a_o(alu_a),
83
    .alu_b_o(alu_b),
84
    .alu_func_o(alu_func),
85
    .alu_signed_o(alu_signed),
86
    .alu_result_i(alu_result),
87
 
88
    // Multiplier
89
    .mul_req_o(mul_req),
90
    .mul_a_o(mul_a),
91
    .mul_b_o(mul_b),
92
    .mul_signed_o(mul_signed),
93
    .mul_ack_i(mul_ack),
94
    .mul_product_i(mul_product),
95
 
96
    // Divider
97
    .div_req_o(div_req),
98
    .div_a_o(div_a),
99
    .div_b_o(div_b),
100
    .div_signed_o(div_signed),
101
    .div_ack_i(div_ack),
102
    .div_quotient_i(div_quotient),
103
    .div_remainder_i(div_remainder),
104
 
105
    // Instruction Memory
106
    .imem_read_o(imem_read),
107
    .imem_addr_o(imem_addr),
108
    .imem_data_i(imem_data),
109
    .imem_done_i(imem_done),
110
 
111
    // Data Memory
112
    .dmem_read_o(dmem_read),
113
    .dmem_write_o(dmem_write),
114
    .dmem_sel_o(dmem_sel),
115
    .dmem_addr_o(dmem_addr),
116
    .dmem_data_o(dmem_data_w),
117
    .dmem_data_i(dmem_data_r),
118
    .dmem_done_i(dmem_done)
119
 
120 2 fafa1971
  );
121
 
122 33 fafa1971
  // ALU
123
  m1_alu m1_alu_0 (
124
    .a_i(alu_a),
125
    .b_i(alu_b),
126
    .func_i(alu_func),
127
    .signed_i(alu_signed),
128 48 fafa1971
    .result_o(alu_result)
129 2 fafa1971
  );
130
 
131 33 fafa1971
  // Multiplier
132
  m1_mul m1_mul_0 (
133
    .sys_reset_i(sys_reset_i),
134
    .sys_clock_i(sys_clock_i),
135
 
136
    .abp_req_i(mul_req),
137
    .a_i(mul_a),
138
    .b_i(mul_b),
139
    .signed_i(mul_signed),
140
    .abp_ack_o(mul_ack),
141
    .product_o(mul_product)
142
  );
143
 
144
  // Divider
145
  m1_div m1_div_0 (
146
    .sys_reset_i(sys_reset_i),
147
    .sys_clock_i(sys_clock_i),
148
 
149
    .abp_req_i(div_req),
150
    .a_i(div_a),
151
    .b_i(div_b),
152
    .signed_i(div_signed),
153
    .abp_ack_o(div_ack),
154
    .quotient_o(div_quotient),
155
    .remainder_o(div_remainder)
156
  );
157
 
158
  // MMU
159
  m1_mmu m1_mmu_0 (
160
 
161
    // System
162
    .sys_clock_i(sys_clock_i),
163
    .sys_reset_i(sys_reset_i),
164
 
165
    // Instruction Memory
166
    .imem_read_i(imem_read),
167
    .imem_addr_i(imem_addr),
168
    .imem_data_o(imem_data),
169
    .imem_done_o(imem_done),
170
 
171
    // Data Memory
172
    .dmem_read_i(dmem_read),
173
    .dmem_write_i(dmem_write),
174
    .dmem_sel_i(dmem_sel),
175
    .dmem_addr_i(dmem_addr),
176
    .dmem_data_i(dmem_data_w),
177
    .dmem_data_o(dmem_data_r),
178
    .dmem_done_o(dmem_done),
179
 
180
    // Wishbone master interface
181
    .wb_cyc_o(wb_cyc_o),
182
    .wb_stb_o(wb_stb_o),
183
    .wb_we_o(wb_we_o),
184
    .wb_adr_o(wb_adr_o),
185
    .wb_dat_o(wb_dat_o),
186
    .wb_sel_o(wb_sel_o),
187
    .wb_ack_i(wb_ack_i),
188
    .wb_dat_i(wb_dat_i)
189
 
190
  );
191
 
192 2 fafa1971
endmodule
193 33 fafa1971
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.