-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPCUnit.sv
79 lines (73 loc) · 1.57 KB
/
PCUnit.sv
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
74
75
76
77
78
79
module PCUnit (
input logic clk, //clk_i
input logic cen, //clk_en
input logic rst, //rst_i
//punit inputs
input logic z_e,
input logic c_e,
input logic [11:0]addr_e,
input logic [7:0]disp_e,
//control unit input
//intreg input
input logic int_c,//we
//stack input
input logic pop_c,//pop_i
input logic push_c,//push_i
//progcounter
input logic PCEn_c,
//ctrl unit
input logic [3:0]PCoper_c,
//output
output logic [11:0]PC_e, //inst_adr_o & PC_e
//intreg outputs
output logic intc_e,
output logic intz_e
);
//intreg out wire
logic [11:0]int_e;
//stack out wire
logic [11:0]stk_e;
//newpc out wire
logic [11:0]PCnew_e;
//assignments
//IntReg
IntReg intreg ( .clk(clk),
.cen(cen),
.rst(rst),
.we(int_c),
.pc_i(PC_e),
.zero_i(z_e),
.carry_i(c_e),
.ipc_o(int_e),
.intc_o(intc_e),
.intz_o(intz_e)
);
//Stack
Stack stack ( .clk(clk),
.cen(cen),
.rst(rst),
.pop_i(pop_c),
.push_i(push_c),
.pc_i(PC_e),
.spc_o(stk_e)
);
//NewPC
NewPC newpc ( .PCoper_i(PCoper_c),
.carry_i(c_e),
.zero_i(z_e),
.ISRaddr_i(int_e),
.stackaddr_i(stk_e),
.offset_i(disp_e),
.addr_i(addr_e),
.PC_i(PC_e),
.Npc_o(PCnew_e)
);
//ProgCounter
ProgCounter counter ( .clk(clk),
.cen(cen),
.rst(rst),
.we(PCEn_c),
.PC_i(PCnew_e),
.PC_o(PC_e)
);
endmodule