Commit ebd12104 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Merge branch 'fragment-t8xx' into merged

parents 71ef6c92 7ab549ab
......@@ -488,6 +488,29 @@ static void print_scalar_field(const char *name, uint16_t* words, uint16_t reg_w
printf("\n");
}
static void print_branch_op(int op)
{
switch (op)
{
case midgard_jmp_writeout_op_branch_cond: printf("cond."); break;
case midgard_jmp_writeout_op_writeout: printf("write."); break;
case midgard_jmp_writeout_op_discard: printf("discard."); break;
default: break;
}
}
static void print_branch_cond(int cond)
{
switch (cond)
{
case 0: printf("write0"); break;
case 1: printf("false"); break;
case 2: printf("true"); break;
case 3: printf("write"); break;
default: break;
}
}
static void print_compact_branch_writeout_field(uint16_t word)
{
midgard_jmp_writeout_op op = word & 0x7;
......@@ -501,9 +524,11 @@ static void print_compact_branch_writeout_field(uint16_t word)
printf("br.uncond ");
if (br_uncond.unknown != 1)
printf("unknown:%d, ", br_uncond.unknown);
if (br_uncond.offset > 0)
if (br_uncond.offset >= 0)
printf("+");
printf("%d\n", br_uncond.offset);
printf("%d", br_uncond.offset);
printf(" -> %X\n", br_uncond.dest_tag);
break;
}
case midgard_jmp_writeout_op_branch_cond:
......@@ -515,35 +540,49 @@ static void print_compact_branch_writeout_field(uint16_t word)
printf("br.");
switch (op)
{
case midgard_jmp_writeout_op_branch_cond: printf("cond."); break;
case midgard_jmp_writeout_op_writeout: printf("write."); break;
case midgard_jmp_writeout_op_discard: printf("discard."); break;
default: break;
}
switch (br_cond.cond)
{
case 0: printf("unk0"); break;
case 1: printf("false"); break;
case 2: printf("true"); break;
case 3: printf("write"); break;
default: break;
}
print_branch_op(br_cond.op);
print_branch_cond(br_cond.cond);
printf(" ");
if (br_cond.offset >= 0)
printf("+");
printf("%d\n", br_cond.offset);
printf("%d", br_cond.offset);
printf(" -> %X\n", br_cond.dest_tag);
break;
}
default:
{
printf("br_op_%d\n", word & 0x7);
printf("br_short_op_%d\n", word & 0x7);
}
}
}
static void print_extended_branch_writeout_field(uint8_t *words)
{
midgard_branch_extended br;
memcpy((char*) &br, (char*) words, sizeof(br));
printf("br.");
print_branch_op(br.op);
print_branch_cond(br.cond);
/* XXX: This can't be right */
if (br.unknown)
printf(".unknown%d\n", br.unknown);
if (br.zero)
printf(".zero%d\n", br.zero);
printf(" ");
if (br.offset >= 0)
printf("+");
printf("%d", br.offset);
printf(" -> %X\n", br.dest_tag);
}
static unsigned num_alu_fields_enabled(uint32_t control_word)
{
unsigned ret = 0;
......@@ -659,17 +698,14 @@ static void print_alu_word(uint32_t* words, unsigned num_quad_words,
if ((control_word >> 26) & 1)
{
print_compact_branch_writeout_field(*word_ptr);
beginning_ptr += 1;
word_ptr += 1;
num_words += 1;
}
if ((control_word >> 27) & 1)
{
ogt_asm_print_tabs(tabs);
printf("branch field: ");
print_16bit_words(word_ptr, 3);
printf("\n");
//ogt_asm_print_tabs(tabs);
print_extended_branch_writeout_field((uint8_t *) word_ptr);
word_ptr += 3;
num_words += 3;
}
......
......@@ -215,6 +215,17 @@ __attribute__((__packed__))
unsigned cond : 2;
} midgard_branch_cond;
typedef struct
__attribute__((__packed__))
{
midgard_jmp_writeout_op op : 3; /* == branch_cond */
unsigned dest_tag : 4; /* tag of branch destination */
unsigned unknown : 2;
signed offset : 7;
unsigned zero : 16;
unsigned cond : 16;
} midgard_branch_extended;
typedef struct
__attribute__((__packed__))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment