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

Subversion Repositories thor

[/] [thor/] [trunk/] [FT64v5/] [rtl/] [twoway/] [FT64_BTB.v] - Blame information for rev 57

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 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 57 robfinch
module FT64_BTB(rst, wclk, wr, wadr, wdat, valid, rclk, pcA, btgtA, pcB, btgtB,
13
                pcC, btgtC, pcD, btgtD, pcE, btgtE, pcF, btgtF,
14
    npcA, npcB, npcC, npcD, npcE, npcF);
15 48 robfinch
parameter AMSB = 31;
16
parameter RSTPC = 32'hFFFC0100;
17
input rst;
18
input wclk;
19
input wr;
20
input [AMSB:0] wadr;
21
input [AMSB:0] wdat;
22
input valid;
23
input rclk;
24
input [AMSB:0] pcA;
25
output [AMSB:0] btgtA;
26
input [AMSB:0] pcB;
27
output [AMSB:0] btgtB;
28
input [AMSB:0] pcC;
29
output [AMSB:0] btgtC;
30
input [AMSB:0] pcD;
31
output [AMSB:0] btgtD;
32 57 robfinch
input [AMSB:0] pcE;
33
output [AMSB:0] btgtE;
34
input [AMSB:0] pcF;
35
output [AMSB:0] btgtF;
36 48 robfinch
input [AMSB:0] npcA;
37
input [AMSB:0] npcB;
38
input [AMSB:0] npcC;
39
input [AMSB:0] npcD;
40 57 robfinch
input [AMSB:0] npcE;
41
input [AMSB:0] npcF;
42 48 robfinch
 
43
integer n;
44
reg [(AMSB+1)*2+1:0] mem [0:1023];
45 57 robfinch
reg [9:0] radrA, radrB, radrC, radrD, radrE, radrF;
46 48 robfinch
initial begin
47
    for (n = 0; n < 1024; n = n + 1)
48
        mem[n] <= RSTPC;
49
end
50
always @(posedge wclk)
51
begin
52
    if (wr) #1 mem[wadr[9:0]][AMSB:0] <= wdat;
53
    if (wr) #1 mem[wadr[9:0]][(AMSB+1)*2:AMSB+1] <= wadr;
54
    if (wr) #1 mem[wadr[9:0]][(AMSB+1)*2+1] <= valid;
55
end
56
always @(posedge rclk)
57
    #1 radrA <= pcA[11:2];
58
always @(posedge rclk)
59
    #1 radrB <= pcB[11:2];
60
always @(posedge rclk)
61
    #1 radrC <= pcC[11:2];
62
always @(posedge rclk)
63
    #1 radrD <= pcD[11:2];
64 57 robfinch
always @(posedge rclk)
65
    #1 radrE <= pcE[11:2];
66
always @(posedge rclk)
67
    #1 radrF <= pcF[11:2];
68 48 robfinch
wire hitA = mem[radrA][(AMSB+1)*2:AMSB+1]==pcA && mem[radrA][(AMSB+1)*2+1];
69
wire hitB = mem[radrB][(AMSB+1)*2:AMSB+1]==pcB && mem[radrB][(AMSB+1)*2+1];
70
wire hitC = mem[radrC][(AMSB+1)*2:AMSB+1]==pcC && mem[radrC][(AMSB+1)*2+1];
71
wire hitD = mem[radrD][(AMSB+1)*2:AMSB+1]==pcD && mem[radrD][(AMSB+1)*2+1];
72 57 robfinch
wire hitE = mem[radrE][(AMSB+1)*2:AMSB+1]==pcE && mem[radrE][(AMSB+1)*2+1];
73
wire hitF = mem[radrF][(AMSB+1)*2:AMSB+1]==pcF && mem[radrF][(AMSB+1)*2+1];
74 48 robfinch
assign btgtA = hitA ? mem[radrA][AMSB:0] : npcA;
75
assign btgtB = hitB ? mem[radrB][AMSB:0] : npcB;
76
assign btgtC = hitC ? mem[radrC][AMSB:0] : npcC;
77
assign btgtD = hitD ? mem[radrD][AMSB:0] : npcD;
78 57 robfinch
assign btgtE = hitE ? mem[radrE][AMSB:0] : npcE;
79
assign btgtF = hitF ? mem[radrF][AMSB:0] : npcF;
80 48 robfinch
 
81
endmodule

powered by: WebSVN 2.1.0

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