OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64/] [rtl/] [twoway/] [FT64_BTB.v] - Blame information for rev 46

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 43 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2017-2018  Robert Finch, Waterloo
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@finitron.ca
6
//       ||
7
//
8
//      FT64_BTB.v
9
//              
10
// ============================================================================
11
//
12
module FT64_BTB(rst, wclk, wr, wadr, wdat, valid, rclk, pcA, btgtA, pcB, btgtB, pcC, btgtC, pcD, btgtD,
13
    npcA, npcB, npcC, npcD);
14
parameter AMSB = 31;
15
parameter RSTPC = 32'hFFFC0100;
16
input rst;
17
input wclk;
18
input wr;
19
input [AMSB:0] wadr;
20
input [AMSB:0] wdat;
21
input valid;
22
input rclk;
23
input [AMSB:0] pcA;
24
output [AMSB:0] btgtA;
25
input [AMSB:0] pcB;
26
output [AMSB:0] btgtB;
27
input [AMSB:0] pcC;
28
output [AMSB:0] btgtC;
29
input [AMSB:0] pcD;
30
output [AMSB:0] btgtD;
31
input [AMSB:0] npcA;
32
input [AMSB:0] npcB;
33
input [AMSB:0] npcC;
34
input [AMSB:0] npcD;
35
 
36
integer n;
37
reg [(AMSB+1)*2+1:0] mem [0:1023];
38
reg [9:0] radrA, radrB, radrC, radrD;
39
initial begin
40
    for (n = 0; n < 1024; n = n + 1)
41
        mem[n] <= RSTPC;
42
end
43
always @(posedge wclk)
44
begin
45
    if (wr) #1 mem[wadr[9:0]][AMSB:0] <= wdat;
46
    if (wr) #1 mem[wadr[9:0]][(AMSB+1)*2:AMSB+1] <= wadr;
47
    if (wr) #1 mem[wadr[9:0]][(AMSB+1)*2+1] <= valid;
48
end
49
always @(posedge rclk)
50
    #1 radrA <= pcA[11:2];
51
always @(posedge rclk)
52
    #1 radrB <= pcB[11:2];
53
always @(posedge rclk)
54
    #1 radrC <= pcC[11:2];
55
always @(posedge rclk)
56
    #1 radrD <= pcD[11:2];
57
wire hitA = mem[radrA][(AMSB+1)*2:AMSB+1]==pcA && mem[radrA][(AMSB+1)*2+1];
58
wire hitB = mem[radrB][(AMSB+1)*2:AMSB+1]==pcB && mem[radrB][(AMSB+1)*2+1];
59
wire hitC = mem[radrC][(AMSB+1)*2:AMSB+1]==pcC && mem[radrC][(AMSB+1)*2+1];
60
wire hitD = mem[radrD][(AMSB+1)*2:AMSB+1]==pcD && mem[radrD][(AMSB+1)*2+1];
61
assign btgtA = hitA ? mem[radrA][AMSB:0] : npcA;
62
assign btgtB = hitB ? mem[radrB][AMSB:0] : npcB;
63
assign btgtC = hitC ? mem[radrC][AMSB:0] : npcC;
64
assign btgtD = hitD ? mem[radrD][AMSB:0] : npcD;
65
 
66
endmodule

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.