def bitfield_update_set_checker(self, input_width, update_set_constraints, test_amt=20):
        from functools import reduce
        from collections import namedtuple
        Update_Info = namedtuple('Update_Info', ['range_start', 'range_end',
                                                 'update_wire', 'update_vals'])

        def ref(i, s, e, u):
            mask = ((1 << (e)) - 1) - ((1 << s) - 1)
            return (i & ~mask) | ((u << s) & mask)
        inp, inp_vals = utils.an_input_and_vals(input_width, test_vals=test_amt, name='inp')
        update_set_list = []
        for ix, (range_start, range_end, update_width) in enumerate(update_set_constraints):
            upd, upd_vals = utils.an_input_and_vals(update_width, test_vals=test_amt,
                                                    name='upd%d' % ix)
            update_set_list.append(Update_Info(range_start, range_end, upd, upd_vals))
        out = pyrtl.Output(input_width, "out")
        bfu_out = pyrtl.bitfield_update_set(
            inp,
            {(ui.range_start, ui.range_end): ui.update_wire for ui in update_set_list}
        )
        self.assertEqual(len(out), len(bfu_out))  # output should have width of input
        out <<= bfu_out
        true_result = []
        for ix, iv in enumerate(inp_vals):
            true_result.append(
                reduce(lambda w, ui: ref(w, ui.range_start, ui.range_end, ui.update_vals[ix]),
                       update_set_list, iv)
            )
        upd_result = utils.sim_and_ret_out(
            out,
            [inp] + [ui.update_wire for ui in update_set_list],
            [inp_vals] + [ui.update_vals for ui in update_set_list],
        )
        self.assertEqual(upd_result, true_result)