This repository was archived by the owner on Mar 24, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplcomp.v
More file actions
65 lines (37 loc) · 1.49 KB
/
plcomp.v
File metadata and controls
65 lines (37 loc) · 1.49 KB
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
`include "ctrl_encode_def.v"
module plcomp(clk, rstn);
input clk, rstn;
wire [31:0] instr;
wire [31:0] PC;
wire MemWrite;
wire MemRead;
wire [31:0] dm_addr, dm_din, dm_dout;
wire [2:0] DMType;
wire reset;
assign reset = rstn;
// instantiation of pipeline CPU
PLCPU U_PLCPU(
.clk(clk), // input: cpu clock
.reset(reset), // input: reset
.inst_in(instr), // input: instruction from im
.Data_in(dm_dout), // input: data to cpu
.mem_w(MemWrite), // output: memory write signal
.mem_r(MemRead), // output: memory read signal
.PC_out(PC), // output: PC to im
.Addr_out(dm_addr), // output: address from cpu to memory
.Data_out(dm_din) // output: data from cpu to memory
);
dm U_DM(
.clk(clk), // input: cpu clock
.DMWr(MemWrite), // input: ram write
.DMRe(MemRead), // input: ram read
.addr(dm_addr), // input: ram address
.din(dm_din), // input: data to ram
.dout(dm_dout) // output: data from ram
);
// instantiation of intruction memory (used for simulation)
im U_imem (
.addr(PC[31:2]), // input: rom address
.dout(instr) // output: instruction
);
endmodule