// ============================================================================
|
// ============================================================================
|
// __
|
// __
|
// \\__/ o\ (C) 2017-2018 Robert Finch, Waterloo
|
// \\__/ o\ (C) 2017-2018 Robert Finch, Waterloo
|
// \ __ / All rights reserved.
|
// \ __ / All rights reserved.
|
// \/_// robfinch<remove>@finitron.ca
|
// \/_// robfinch<remove>@finitron.ca
|
// ||
|
// ||
|
//
|
//
|
// FT64_stomp.v
|
// FT64_stomp.v
|
//
|
//
|
// This source file is free software: you can redistribute it and/or modify
|
// This source file is free software: you can redistribute it and/or modify
|
// it under the terms of the GNU Lesser General Public License as published
|
// it under the terms of the GNU Lesser General Public License as published
|
// by the Free Software Foundation, either version 3 of the License, or
|
// by the Free Software Foundation, either version 3 of the License, or
|
// (at your option) any later version.
|
// (at your option) any later version.
|
//
|
//
|
// This source file is distributed in the hope that it will be useful,
|
// This source file is distributed in the hope that it will be useful,
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// GNU General Public License for more details.
|
// GNU General Public License for more details.
|
//
|
//
|
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
//
|
//
|
// ============================================================================
|
// ============================================================================
|
//
|
//
|
`define QBITS 2:0
|
`include "FT64_config.vh"
|
|
|
module FT64_stomp(branchmiss,branchmiss_thrd,missid,head0,thrd,iqentry_v,stomp);
|
module FT64_stomp(branchmiss,branchmiss_thrd,missid,head0,thrd,iqentry_v,stomp);
|
parameter QENTRIES = 8;
|
parameter QENTRIES = `QENTRIES;
|
input branchmiss;
|
input branchmiss;
|
input branchmiss_thrd;
|
input branchmiss_thrd;
|
input [`QBITS] missid;
|
input [`QBITS] missid;
|
input [`QBITS] head0;
|
input [`QBITS] head0;
|
input [QENTRIES-1:0] thrd;
|
input [QENTRIES-1:0] thrd;
|
input [QENTRIES-1:0] iqentry_v;
|
input [QENTRIES-1:0] iqentry_v;
|
output reg [QENTRIES-1:0] stomp;
|
output reg [QENTRIES-1:0] stomp;
|
|
|
// Stomp logic for branch miss.
|
// Stomp logic for branch miss.
|
|
|
integer n;
|
integer n;
|
reg [QENTRIES-1:0] stomp2;
|
reg [QENTRIES-1:0] stomp2;
|
reg [`QBITS] contid;
|
reg [`QBITS] contid;
|
always @*
|
always @*
|
if (branchmiss) begin
|
if (branchmiss) begin
|
stomp2 = 8'h00;
|
stomp2 = {QENTRIES{1'b0}};
|
|
|
// If missed at the head, all queue entries but the head are stomped on.
|
// If missed at the head, all queue entries but the head are stomped on.
|
if (head0==missid) begin
|
if (head0==missid) begin
|
for (n = 0; n < QENTRIES; n = n + 1)
|
for (n = 0; n < QENTRIES; n = n + 1)
|
if (n!=missid) begin
|
if (n!=missid) begin
|
if (thrd[n]==branchmiss_thrd)
|
if (thrd[n]==branchmiss_thrd)
|
stomp2[n] = iqentry_v[n];
|
stomp2[n] = iqentry_v[n];
|
end
|
end
|
end
|
end
|
// If head0 is after the missid queue entries between the missid and
|
// If head0 is after the missid queue entries between the missid and
|
// head0 are stomped on.
|
// head0 are stomped on.
|
else if (head0 > missid) begin
|
else if (head0 > missid) begin
|
for (n = 0; n < QENTRIES; n = n + 1)
|
for (n = 0; n < QENTRIES; n = n + 1)
|
if (n > missid && n < head0) begin
|
if (n > missid && n < head0) begin
|
if (thrd[n]==branchmiss_thrd)
|
if (thrd[n]==branchmiss_thrd)
|
stomp2[n] = iqentry_v[n];
|
stomp2[n] = iqentry_v[n];
|
end
|
end
|
end
|
end
|
// Otherwise still queue entries between missid and head0 are stomped on
|
// Otherwise still queue entries between missid and head0 are stomped on
|
// but the range 'wraps around'.
|
// but the range 'wraps around'.
|
else begin
|
else begin
|
for (n = 0; n < QENTRIES; n = n + 1)
|
for (n = 0; n < QENTRIES; n = n + 1)
|
if (n < head0) begin
|
if (n < head0) begin
|
if (thrd[n]==branchmiss_thrd)
|
if (thrd[n]==branchmiss_thrd)
|
stomp2[n] = iqentry_v[n];
|
stomp2[n] = iqentry_v[n];
|
end
|
end
|
for (n = 0; n < QENTRIES; n = n + 1)
|
for (n = 0; n < QENTRIES; n = n + 1)
|
if (n >= missid + 1) begin
|
if (n >= missid + 1) begin
|
if (thrd[n]==branchmiss_thrd)
|
if (thrd[n]==branchmiss_thrd)
|
stomp2[n] = iqentry_v[n];
|
stomp2[n] = iqentry_v[n];
|
end
|
end
|
end
|
end
|
stomp = stomp2;
|
stomp = stomp2;
|
end
|
end
|
else begin
|
else begin
|
stomp = {QENTRIES{1'b0}};
|
stomp = {QENTRIES{1'b0}};
|
end
|
end
|
|
|
endmodule
|
endmodule
|
|
|