summaryrefslogtreecommitdiff
path: root/rtl/core/core.sv
blob: cf63b2d12ccbf5033c47635e04c2ed1622579868 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
`include "core/uarch.sv"
`include "config.sv"

module core
#(parameter ID=0)
(
	input  logic      clk,
	                  rst_n,

	input  wire       step,
	input  wire       cpu_halt,
	output wire       cpu_alive,
	output wire       cpu_halted,
	output wire       breakpoint,

	output word       avl_address,
	output logic      avl_read,
	                  avl_write,
	                  avl_lock,
	input  word       avl_readdata,
	output word       avl_writedata,
	input  logic      avl_waitrequest,
	input  logic[1:0] avl_response,
	output logic[3:0] avl_byteenable,

	input  logic      avl_irq
);

	generate
		if (ID < `CONFIG_CPUS) begin: enable
			assign cpu_alive = 1;

			ptr addr;
			word data_wr;
			logic start, write;
			logic[3:0] data_be;

			arm810 cpu
			(
				.irq(avl_irq),
				.halt(cpu_halt),
				.halted(cpu_halted),
				.bus_addr(addr),
				.bus_data_rd(data_rd),
				.bus_data_wr(data_wr),
				.bus_data_be(data_be),
				.bus_ready(ready),
				.bus_write(write),
				.bus_start(start),
				.bus_ex_fail(ex_fail),
				.bus_ex_lock(ex_lock),
				.*
			);

			word data_rd;
			logic ex_fail, ex_lock, ready;

			bus_master master
			(
				.*
			);
		end else begin
			assign cpu_alive = 0;
			assign cpu_halted = 1;
			assign breakpoint = 0;

			assign avl_lock = 0;
			assign avl_read = 0;
			assign avl_write = 0;
		end
	endgenerate

endmodule