@@ -481,25 +481,27 @@ class adc_ctrl_scoreboard extends cip_base_scoreboard #(
481481 bit filter_match;
482482 // Perform the basic match against filter config
483483 for (int filter_idx = 0 ; filter_idx < ADC_CTRL_NUM_FILTERS ; filter_idx++ ) begin
484+ bit en_somewhere, mismatch_somewhere;
485+
484486 // Extract appropriate configuration for this channel/filter
485487 adc_ctrl_filter_cfg filter_cfg = cfg.filter_cfg[channel][filter_idx];
486488 // Check value against configured range of values
487489 bit inside_range = val inside { [filter_cfg.min_v : filter_cfg.max_v]} ;
488490 // Set match flag for this channel/filter considering inside/outside config
489491 m_chn_match[channel][filter_idx] = filter_cfg.match_outside ^ inside_range;
490492
491- // Combine channel matches for this filter
492- filter_match = 0 ;
493+ // Combine channel matches for this filter. We expect a match for the filter if
494+ //
495+ // - This filter is enabled on at least one channel
496+ // - On every channel where the filter is enabled, it gets a match.
493497 for (int channel_idx = 0 ; channel_idx < ADC_CTRL_CHANNELS ; channel_idx++ ) begin
494- filter_match | = cfg.filter_cfg[channel_idx][filter_idx].enabled;
498+ if (cfg.filter_cfg[channel_idx][filter_idx].enabled) begin
499+ en_somewhere = 1 ;
500+ mismatch_somewhere | = ~ m_chn_match[channel_idx][filter_idx];
501+ end
495502 end
496503
497- for (int channel_idx = 0 ; channel_idx < ADC_CTRL_CHANNELS ; channel_idx++ ) begin
498- filter_match & = ! cfg.filter_cfg[channel_idx][filter_idx].enabled |
499- (m_chn_match[channel_idx][filter_idx] &
500- cfg.filter_cfg[channel_idx][filter_idx].enabled);
501- end
502- m_match[filter_idx] = filter_match;
504+ m_match[filter_idx] = en_somewhere & ~ mismatch_somewhere;
503505 end
504506
505507 // If this was data from the last channel process debounce model
0 commit comments