Project Full coverage report
Current view: Cores-VeeR-EL2—Cores-VeeR-EL2—design—lsu—el2_lsu_trigger.sv Coverage Hit Total
Test Date: 19-09-2024 Toggle 100.0% 10 10
Test: all Branch 100.0% 4 4

            Line data    Source code
       1              : // SPDX-License-Identifier: Apache-2.0
       2              : // Copyright 2020 Western Digital Corporation or its affiliates.
       3              : //
       4              : // Licensed under the Apache License, Version 2.0 (the "License");
       5              : // you may not use this file except in compliance with the License.
       6              : // You may obtain a copy of the License at
       7              : //
       8              : // http://www.apache.org/licenses/LICENSE-2.0
       9              : //
      10              : // Unless required by applicable law or agreed to in writing, software
      11              : // distributed under the License is distributed on an "AS IS" BASIS,
      12              : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13              : // See the License for the specific language governing permissions and
      14              : // limitations under the License.
      15              : 
      16              : //********************************************************************************
      17              : // $Id$
      18              : //
      19              : //
      20              : // Owner:
      21              : // Function: LSU Trigger logic
      22              : // Comments:
      23              : //
      24              : //********************************************************************************
      25              : module el2_lsu_trigger
      26              : import el2_pkg::*;
      27              : #(
      28              : `include "el2_param.vh"
      29              :  )(
      30            1 :    input el2_trigger_pkt_t [3:0] trigger_pkt_any,            // trigger packet from dec
      31       478185 :    input el2_lsu_pkt_t           lsu_pkt_m,                  // lsu packet
      32       596547 :    input logic [31:0]             lsu_addr_m,                 // address
      33        83823 :    input logic [31:0]             store_data_m,               // store data
      34              : 
      35         2450 :    output logic [3:0]             lsu_trigger_match_m         // match result
      36              : );
      37              : 
      38            1 :    logic               trigger_enable;
      39         2437 :    logic [3:0][31:0]  lsu_match_data;
      40         2769 :    logic [3:0]        lsu_trigger_data_match;
      41         2437 :    logic [31:0]       store_data_trigger_m;
      42         2437 :    logic [31:0]       ldst_addr_trigger_m;
      43              : 
      44              :    // Generate the trigger enable (This is for power)
      45          317 :    always_comb begin
      46          317 :       trigger_enable = 1'b0;
      47          317 :       for (int i=0; i<4; i++) begin
      48         1268 :          trigger_enable |= trigger_pkt_any[i].m;
      49              :       end
      50              :    end
      51              : 
      52              :    assign store_data_trigger_m[31:0] = {({16{lsu_pkt_m.word}} & store_data_m[31:16]),({8{(lsu_pkt_m.half | lsu_pkt_m.word)}} & store_data_m[15:8]), store_data_m[7:0]} & {32{trigger_enable}};
      53              :    assign ldst_addr_trigger_m[31:0]  = lsu_addr_m[31:0] & {32{trigger_enable}};
      54              : 
      55              : 
      56              :    for (genvar i=0; i<4; i++) begin : genblock
      57              :       assign lsu_match_data[i][31:0] = ({32{~trigger_pkt_any[i].select}} & ldst_addr_trigger_m[31:0]) |
      58              :                                        ({32{trigger_pkt_any[i].select & trigger_pkt_any[i].store}} & store_data_trigger_m[31:0]);
      59              : 
      60              :       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]));
      61              : 
      62              :       assign lsu_trigger_match_m[i] = lsu_pkt_m.valid & ~lsu_pkt_m.dma & trigger_enable &
      63              :                                         ((trigger_pkt_any[i].store & lsu_pkt_m.store) | (trigger_pkt_any[i].load & lsu_pkt_m.load & ~trigger_pkt_any[i].select)) &
      64              :                                         lsu_trigger_data_match[i];
      65              :    end
      66              : 
      67              : 
      68              : endmodule // el2_lsu_trigger