def test_named_fields(self):
        self.assertEqual(
            pyrtl.bitpattern_to_val(
                '0000000sssssrrrrr000ddddd0110011', s=1, r=2, d=3
            ),  # RISC-V ADD
            0b00000000000100010000000110110011
        )

        self.assertEqual(
            pyrtl.bitpattern_to_val('iiiiiiisssssrrrrr010iiiii0100011', i=1, s=3, r=4),  # RISC-V SW
            0b00000000001100100010000010100011
        )

        self.assertEqual(
            pyrtl.bitpattern_to_val(
                'ijjjjjjsssssrrrrr100jjjjk1100011',
                s=2, r=3, **TestBitpatternToVal.r5_br_immed(-5)
            ),  # RISC-V BLT
            0b11111110001000011100101111100011
        )