...
  View open merge request
Commits (6)
...@@ -488,6 +488,29 @@ static void print_scalar_field(const char *name, uint16_t* words, uint16_t reg_w ...@@ -488,6 +488,29 @@ static void print_scalar_field(const char *name, uint16_t* words, uint16_t reg_w
printf("\n"); 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) static void print_compact_branch_writeout_field(uint16_t word)
{ {
midgard_jmp_writeout_op op = word & 0x7; midgard_jmp_writeout_op op = word & 0x7;
...@@ -501,9 +524,11 @@ static void print_compact_branch_writeout_field(uint16_t word) ...@@ -501,9 +524,11 @@ static void print_compact_branch_writeout_field(uint16_t word)
printf("br.uncond "); printf("br.uncond ");
if (br_uncond.unknown != 1) if (br_uncond.unknown != 1)
printf("unknown:%d, ", br_uncond.unknown); printf("unknown:%d, ", br_uncond.unknown);
if (br_uncond.offset > 0) if (br_uncond.offset >= 0)
printf("+"); printf("+");
printf("%d\n", br_uncond.offset); printf("%d", br_uncond.offset);
printf(" -> %X\n", br_uncond.dest_tag);
break; break;
} }
case midgard_jmp_writeout_op_branch_cond: case midgard_jmp_writeout_op_branch_cond:
...@@ -515,35 +540,49 @@ static void print_compact_branch_writeout_field(uint16_t word) ...@@ -515,35 +540,49 @@ static void print_compact_branch_writeout_field(uint16_t word)
printf("br."); printf("br.");
switch (op) print_branch_op(br_cond.op);
{ print_branch_cond(br_cond.cond);
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;
}
printf(" "); printf(" ");
if (br_cond.offset >= 0) if (br_cond.offset >= 0)
printf("+"); printf("+");
printf("%d\n", br_cond.offset); printf("%d", br_cond.offset);
printf(" -> %X\n", br_cond.dest_tag);
break; break;
} }
default: 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) static unsigned num_alu_fields_enabled(uint32_t control_word)
{ {
unsigned ret = 0; unsigned ret = 0;
...@@ -659,17 +698,14 @@ static void print_alu_word(uint32_t* words, unsigned num_quad_words, ...@@ -659,17 +698,14 @@ static void print_alu_word(uint32_t* words, unsigned num_quad_words,
if ((control_word >> 26) & 1) if ((control_word >> 26) & 1)
{ {
print_compact_branch_writeout_field(*word_ptr); print_compact_branch_writeout_field(*word_ptr);
beginning_ptr += 1;
word_ptr += 1; word_ptr += 1;
num_words += 1; num_words += 1;
} }
if ((control_word >> 27) & 1) if ((control_word >> 27) & 1)
{ {
ogt_asm_print_tabs(tabs); //ogt_asm_print_tabs(tabs);
printf("branch field: "); print_extended_branch_writeout_field((uint8_t *) word_ptr);
print_16bit_words(word_ptr, 3);
printf("\n");
word_ptr += 3; word_ptr += 3;
num_words += 3; num_words += 3;
} }
......
...@@ -215,6 +215,17 @@ __attribute__((__packed__)) ...@@ -215,6 +215,17 @@ __attribute__((__packed__))
unsigned cond : 2; unsigned cond : 2;
} midgard_branch_cond; } 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 typedef struct
__attribute__((__packed__)) __attribute__((__packed__))
{ {
......