-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIns_mem.v
48 lines (48 loc) · 1.04 KB
/
Ins_mem.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
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:14:02 06/20/2022
// Design Name:
// Module Name: Ins_mem
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module Ins_mem(
input clk,
input z,
input br,
output reg [19:0] ins,
input [19:0] extend
);
assign pc_in = 0;
reg [199:0] arr [19:0];
reg [19:0] pc_out;
reg br_tk;
always @(posedge clk)
begin
assign br_tk = z && br;
if(br_tk == 0)
begin
assign pc_out = pc_in;
assign pc_out = pc_out+4;
assign ins = arr[pc_out];
end
else
begin
assign pc_out=pc_in;
assign pc_out = pc_out + 4 + (extend * 4);
assign ins = arr[pc_out];
end
end
endmodule