2022-05-10 21:06:26 +08:00
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 Western Digital Corporation or its affiliates.
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// 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$
//
//
// Owner:
// Function: DEC Trigger Logic
// Comments:
//
//********************************************************************************
module el2_dec_trigger
2022-05-23 22:16:04 +08:00
import el2_pkg::* ;
2022-05-10 21:06:26 +08:00
# (
2022-05-23 22:16:04 +08:00
`include " el2_param.vh "
) (
2022-05-10 21:06:26 +08:00
2022-05-23 22:16:04 +08:00
input el2_trigger_pkt_t [ 3 : 0 ] trigger_pkt_any , // Packet from tlu. 'select':0-pc,1-Opcode 'Execute' needs to be set for dec triggers to fire. 'match'-1 do mask, 0: full match
input logic [ 31 : 1 ] dec_i0_pc_d , // i0 pc
2022-05-10 21:06:26 +08:00
2022-05-23 22:16:04 +08:00
output logic [ 3 : 0 ] dec_i0_trigger_match_d // Trigger match
2022-05-10 21:06:26 +08:00
) ;
2022-05-23 22:16:04 +08:00
logic [ 3 : 0 ] [ 31 : 0 ] dec_i0_match_data ;
logic [ 3 : 0 ] dec_i0_trigger_data_match ;
2022-05-10 21:06:26 +08:00
2022-05-23 22:16:04 +08:00
for ( genvar i = 0 ; i < 4 ; i + + ) begin
assign dec_i0_match_data [ i ] [ 31 : 0 ] = ( { 32 { ~ trigger_pkt_any [ i ] . select & trigger_pkt_any [ i ] . execute } } & { dec_i0_pc_d [ 31 : 1 ] , trigger_pkt_any [ i ] . tdata2 [ 0 ] } ) ; // select=0; do a PC match
2022-05-10 21:06:26 +08:00
2022-05-23 22:16:04 +08:00
rvmaskandmatch trigger_i0_match (
. mask ( trigger_pkt_any [ i ] . tdata2 [ 31 : 0 ] ) ,
. data ( dec_i0_match_data [ i ] [ 31 : 0 ] ) ,
. masken ( trigger_pkt_any [ i ] . match ) ,
. match ( dec_i0_trigger_data_match [ i ] )
) ;
2022-05-10 21:06:26 +08:00
2022-05-23 22:16:04 +08:00
assign dec_i0_trigger_match_d [ i ] = trigger_pkt_any [ i ] . execute & trigger_pkt_any [ i ] . m & dec_i0_trigger_data_match [ i ] ;
end
2022-05-10 21:06:26 +08:00
2022-05-23 22:16:04 +08:00
endmodule // el2_dec_trigger
2022-05-10 21:06:26 +08:00