def test_match_bitwidth_with_pattern_matched_fields_with_field_map(self):
        i = pyrtl.Input(5, 'i')
        out = pyrtl.Output(2, 'out')

        field_map = {'a': 'field1', 'b': 'field2'}
        with pyrtl.conditional_assignment:
            with pyrtl.match_bitpattern(i, '1a?a0', field_map) as x:
                out |= x.field1
            with pyrtl.match_bitpattern(i, 'b0?1b', field_map) as x:
                out |= x.field2
            with pyrtl.match_bitpattern(i, 'ba1ab', field_map) as x:
                out |= x.field1 + x.field2

        self.check_all_accesses_valid()