2019-06-04 22:57:48 +08:00
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
// Copyright 2019 Western Digital Corporation or its affiliates.
|
2020-02-20 10:25:04 +08:00
|
|
|
//
|
2019-06-04 22:57:48 +08:00
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
2020-02-20 10:25:04 +08:00
|
|
|
//
|
2019-06-04 22:57:48 +08:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2020-02-20 10:25:04 +08:00
|
|
|
//
|
2019-06-04 22:57:48 +08:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
|
|
|
//********************************************************************************
|
|
|
|
// $Id$
|
|
|
|
//
|
2020-02-20 10:25:04 +08:00
|
|
|
//
|
|
|
|
// Owner:
|
2019-06-04 22:57:48 +08:00
|
|
|
// Function: LSU Trigger logic
|
|
|
|
// Comments:
|
|
|
|
//
|
|
|
|
//********************************************************************************
|
2020-02-20 10:25:04 +08:00
|
|
|
module lsu_trigger
|
2019-06-04 22:57:48 +08:00
|
|
|
import swerv_types::*;
|
|
|
|
(
|
2019-08-14 03:48:48 +08:00
|
|
|
input logic clk, // clock
|
|
|
|
input logic lsu_free_c2_clk, // clock
|
|
|
|
input logic rst_l, // reset
|
2019-06-04 22:57:48 +08:00
|
|
|
|
|
|
|
input trigger_pkt_t [3:0] trigger_pkt_any, // trigger packet from dec
|
|
|
|
input lsu_pkt_t lsu_pkt_dc3, // lsu packet
|
2020-02-20 10:25:04 +08:00
|
|
|
input logic [31:0] lsu_addr_dc3, // address
|
2019-06-04 22:57:48 +08:00
|
|
|
input logic [31:0] lsu_result_dc3, // load data
|
|
|
|
input logic [31:0] store_data_dc3, // store data
|
|
|
|
|
|
|
|
output logic [3:0] lsu_trigger_match_dc3 // match result
|
|
|
|
);
|
|
|
|
|
|
|
|
logic [3:0][31:0] lsu_match_data;
|
|
|
|
logic [3:0] lsu_trigger_data_match;
|
|
|
|
logic [31:0] store_data_trigger_dc3;
|
|
|
|
|
|
|
|
assign store_data_trigger_dc3[31:0] = { ({16{lsu_pkt_dc3.word}} & store_data_dc3[31:16]) , ({8{(lsu_pkt_dc3.half | lsu_pkt_dc3.word)}} & store_data_dc3[15:8]), store_data_dc3[7:0]};
|
2020-02-20 10:25:04 +08:00
|
|
|
|
|
|
|
|
2019-06-04 22:57:48 +08:00
|
|
|
for (genvar i=0; i<4; i++) begin
|
|
|
|
assign lsu_match_data[i][31:0] = ({32{~trigger_pkt_any[i].select}} & lsu_addr_dc3[31:0]) |
|
|
|
|
({32{trigger_pkt_any[i].select & trigger_pkt_any[i].store}} & store_data_trigger_dc3[31:0]);
|
2020-02-20 10:25:04 +08:00
|
|
|
|
|
|
|
|
2019-06-04 22:57:48 +08:00
|
|
|
rvmaskandmatch trigger_match (.mask(trigger_pkt_any[i].tdata2[31:0]), .data(lsu_match_data[i][31:0]), .masken(trigger_pkt_any[i].match), .match(lsu_trigger_data_match[i]));
|
|
|
|
|
|
|
|
assign lsu_trigger_match_dc3[i] = lsu_pkt_dc3.valid & ~lsu_pkt_dc3.dma &
|
|
|
|
((trigger_pkt_any[i].store & lsu_pkt_dc3.store) | (trigger_pkt_any[i].load & lsu_pkt_dc3.load & ~trigger_pkt_any[i].select)) &
|
|
|
|
lsu_trigger_data_match[i];
|
|
|
|
end
|
|
|
|
|
2020-02-20 10:25:04 +08:00
|
|
|
|
2019-06-04 22:57:48 +08:00
|
|
|
endmodule // lsu_trigger
|