-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPCIM.v
73 lines (63 loc) · 1.92 KB
/
PCIM.v
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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:23:56 08/11/2017
// Design Name:
// Module Name: PCIM
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module PCIM(ins, Current_Address,jmp_loc, pc_mux_sel, Stall, Stall_pm, reset, clk);
input[7:0] jmp_loc;
input pc_mux_sel;
input Stall;
input Stall_pm;
input reset, clk;
output wire[23:0] ins;
output wire[7:0] Current_Address;
wire [7:0] CAJ,CAR,IA;
wire [23:0] ins_PM,PM_out;
reg [7:0] Hold_Address, Next_Address;
reg [23:0] ins_prv;
assign CAJ=(Stall==0)? Next_Address: Hold_Address;
assign CAR=(pc_mux_sel==0)? CAJ : jmp_loc;
assign Current_Address=(reset==0)? 8'b0 : CAR;
Program_Memory PM(
.clka(clk), // input clka
.addra(Current_Address), // input [7 : 0] addra
.douta(PM_out) // output [23 : 0] douta
);
//Reg INS1(ins_prv,ins, clk, reset);
assign ins_PM=(Stall_pm==0)?PM_out : ins_prv;
assign ins=(reset==0)? 24'b0 : ins_PM;
assign IA=(Current_Address+ 8'b00000001);
//------------------------------------------------------------------------//
wire [7:0] temp1,temp2;
assign temp1=(reset==1'b0)? 8'b00000000 :Current_Address ;
assign temp2=(reset==1'b0)? 8'b00000000 :IA ;
always @(posedge clk)
begin
Hold_Address<=temp1;
Next_Address<=temp2;
end
//------------------------------------------------------------------------//
//------------------------------------------------------------------------//
wire [23:0] temp3;
assign temp3 = (reset== 1'b0)? 24'b0 : ins ;
always @(posedge clk)
begin
ins_prv <= temp3;
end
//---------------------------------------------------------------------------//
endmodule