-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpc.v
More file actions
43 lines (40 loc) · 812 Bytes
/
pc.v
File metadata and controls
43 lines (40 loc) · 812 Bytes
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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:27:55 04/15/2018
// Design Name:
// Module Name: Program_counter
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module Program_counter(
input clk,
input reset,
input [31:0] pc_i,
output [31:0]pc
);
reg [31:0]pc;
reg [31:0]pc_temp;
always@(*) //this will store the value of pc_i
pc_temp = pc_i;
always@(posedge clk)
begin
if(reset)
pc = 0;
else
begin pc = pc_temp + 32'd4;
pc_temp = pc;
end
end
endmodule