3 module System(input clk, output wire bubbleshield, output wire [31:0] insn, output wire [31:0] pc);
13 assign bus_req = {7'b0, bus_req_icache};
14 wire bus_ack_icache = bus_ack[`BUS_ICACHE];
16 wire [31:0] bus_addr_icache;
17 wire [31:0] bus_wdata_icache;
21 wire [31:0] bus_rdata_blockram;
22 wire bus_ready_blockram;
24 assign bus_addr = bus_addr_icache;
25 assign bus_rdata = bus_rdata_blockram;
26 assign bus_wdata = bus_wdata_icache;
27 assign bus_rd = bus_rd_icache;
28 assign bus_wr = bus_wr_icache;
29 assign bus_ready = bus_ready_blockram;
31 wire [31:0] icache_rd_addr;
34 wire [31:0] icache_rd_data;
36 wire stall_cause_issue;
38 wire stall_in_fetch = stall_cause_issue;
39 wire stall_in_issue = 0;
41 wire bubble_out_fetch;
42 wire bubble_out_issue;
43 wire [31:0] insn_out_fetch;
44 wire [31:0] insn_out_issue;
45 wire [31:0] pc_out_fetch;
46 wire [31:0] pc_out_issue;
48 assign bubbleshield = bubble_out_issue;
49 assign insn = insn_out_issue;
50 assign pc = pc_out_issue;
52 BusArbiter busarbiter(.bus_req(bus_req), .bus_ack(bus_ack));
57 .rd_addr(icache_rd_addr), .rd_req(icache_rd_req),
58 .rd_wait(icache_rd_wait), .rd_data(icache_rd_data),
59 .bus_req(bus_req_icache), .bus_ack(bus_ack_icache),
60 .bus_addr(bus_addr_icache), .bus_rdata(bus_rdata),
61 .bus_wdata(bus_wdata_icache), .bus_rd(bus_rd_icache),
62 .bus_wr(bus_wr_icache), .bus_ready(bus_ready));
66 .bus_addr(bus_addr), .bus_rdata(bus_rdata_blockram),
67 .bus_wdata(bus_wdata), .bus_rd(bus_rd), .bus_wr(bus_wr),
68 .bus_ready(bus_ready_blockram));
73 .rd_addr(icache_rd_addr), .rd_req(icache_rd_req),
74 .rd_wait(icache_rd_wait), .rd_data(icache_rd_data),
75 .stall(stall_in_fetch), .jmp(0 /* XXX */), .jmppc(0 /* XXX */),
76 .bubble(bubble_out_fetch), .insn(insn_out_fetch),
82 .stall(stall_in_issue), .flush(0 /* XXX */),
83 .inbubble(bubble_out_fetch), .insn(insn_out_fetch),
84 .inpc(pc_out_fetch), .cpsr(0 /* XXX */),
85 .outstall(stall_cause_issue), .outbubble(bubble_out_issue),
86 .outpc(pc_out_issue), .outinsn(insn_out_issue));
88 reg [31:0] clockno = 0;
91 clockno <= clockno + 1;
92 $display("------------------------------------------------------------------------------");
93 $display("%3d: FETCH: Bubble: %d, Instruction: %08x, PC: %08x", clockno, bubble_out_fetch, insn_out_fetch, pc_out_fetch);
94 $display("%3d: ISSUE: Stall: %d, Bubble: %d, Instruction: %08x, PC: %08x", clockno, stall_cause_issue, bubble_out_issue, insn_out_issue, pc_out_issue);