Пример #1
0
static bool
test_fuzz_compact_instruction(struct brw_compile *p, brw_inst src)
{
   for (int bit0 = 0; bit0 < 128; bit0++) {
      if (skip_bit(p->brw, &src, bit0))
	 continue;

      for (int bit1 = 0; bit1 < 128; bit1++) {
         brw_inst instr = src;
	 uint32_t *bits = (uint32_t *)&instr;

         if (skip_bit(p->brw, &src, bit1))
	    continue;

	 bits[bit0 / 32] ^= (1 << (bit0 & 31));
	 bits[bit1 / 32] ^= (1 << (bit1 & 31));

         clear_pad_bits(p->brw, &instr);

	 if (!test_compact_instruction(p, instr)) {
	    printf("  twiddled bits for fuzzing %d, %d\n", bit0, bit1);
	    return false;
	 }
      }
   }

   return true;
}
Пример #2
0
static bool
test_fuzz_compact_instruction(struct brw_codegen *p, brw_inst src)
{
   for (int bit0 = 0; bit0 < 128; bit0++) {
      if (skip_bit(p->devinfo, &src, bit0))
	 continue;

      for (int bit1 = 0; bit1 < 128; bit1++) {
         brw_inst instr = src;
	 uint64_t *bits = instr.data;

         if (skip_bit(p->devinfo, &src, bit1))
	    continue;

	 bits[bit0 / 64] ^= (1ull << (bit0 & 63));
	 bits[bit1 / 64] ^= (1ull << (bit1 & 63));

         clear_pad_bits(p->devinfo, &instr);

	 if (!test_compact_instruction(p, instr)) {
	    printf("  twiddled bits for fuzzing %d, %d\n", bit0, bit1);
	    return false;
	 }
      }
   }

   return true;
}
Пример #3
0
static void write_digit(unsigned char seg, unsigned char data, unsigned char erase, unsigned char skip)
{
	static const unsigned char delete_order[7]={SEG_U,SEG_UR,SEG_UL,SEG_M,SEG_OR,SEG_OL,SEG_O};
	static const unsigned char set_order[7]={SEG_O,SEG_OR,SEG_UR,SEG_U,SEG_UL,SEG_OL,SEG_M};

	unsigned char i;

	if ((skip & SEG_ALL) != SEG_ALL)
	{
		SET_STROBE;

		WAIT_FULL(DATA_DELAY);
		// pump data

		for (i=0x80; i; i>>=1)
		{
			shift_bit(data&i);
		}

		// pump address


		for (i=0x80; i; i>>=1)
		{
			shift_bit(seg&i);
		}

		CLR_STROBE; // falling strobe, latch data

		WAIT_HALF(DATA_DELAY);

		CLR_CLK;

		WAIT_HALF(DATA_DELAY);

		// enable segments??
		if (erase)
		{
			CLR_DATA;
			for (i=0; i<7; i++)
			{
				if (skip&delete_order[i])
				{
					skip_bit();
				}
				else
				{
					shift_mech();
				}
			}
		}
		else
		{
			SET_DATA;
			for (i=0; i<7; i++)
			{
				if (skip&set_order[i])
				{
					skip_bit();
				}
				else
				{
					shift_mech();
				}
			}
		}
		SET_CLK;
	}