}
+/* start-sanitize-sky */
+#ifdef TARGET_SKY
void
cop_lq (SIM_DESC sd,
sim_cpu *cpu,
{
switch (coproc_num)
{
- /* start-sanitize-sky */
case 2:
/* XXX COP2 */
break;
- /* end-sanitize-sky */
default:
sim_io_printf(sd,"COP_LQ(%d,%d,??) at PC = 0x%s : TODO (architecture specific)\n",
return;
}
+#endif /* TARGET_SKY */
+/* end-sanitize-sky */
unsigned int
}
+/* start-sanitize-sky */
+#ifdef TARGET_SKY
unsigned128
cop_sq (SIM_DESC sd,
sim_cpu *cpu,
int coproc_num,
int coproc_reg)
{
- unsigned128 value = {0, 0};
+ unsigned128 value = U16_8(0, 0);
switch (coproc_num)
{
- /* start-sanitize-sky */
case 2:
/* XXX COP2 */
break;
- /* end-sanitize-sky */
default:
sim_io_printf(sd,"COP_SQ(%d,%d) at PC = 0x%s : TODO (architecture specific)\n",
return(value);
}
+#endif /* TARGET_SKY */
+/* end-sanitize-sky */
void
int i_15_11 = (instruction >> 11) & 0x1f;
int i_15_0 = instruction & 0xffff;
int i_10_1 = (instruction >> 1) & 0x3ff;
+ int i_5_0 = instruction & 0x03f;
int interlock = instruction & 0x01;
- unsigned_4 vpe_status = sim_core_read_aligned_4 (cpu, cia, read_map, VPE0_STAT);
- int vpe_busy = (vpe_status & 0x00000001);
+ int co = (instruction >> 25) & 0x01;
/* setup for semantic.c-like actions below */
typedef unsigned_4 instruction_word;
int CIA = cia;
if(i_25_21 == 0x08 && i_20_16 == 0x00) /* BC2F */
{
address_word offset = EXTEND16(i_15_0) << 2;
- if(! vpe_busy) DELAY_SLOT(cia + 4 + offset);
+ if(! vu0_busy()) DELAY_SLOT(cia + 4 + offset);
}
else if(i_25_21 == 0x08 && i_20_16==0x02) /* BC2FL */
{
address_word offset = EXTEND16(i_15_0) << 2;
- if(! vpe_busy) DELAY_SLOT(cia + 4 + offset);
+ if(! vu0_busy()) DELAY_SLOT(cia + 4 + offset);
else NULLIFY_NEXT_INSTRUCTION();
}
else if(i_25_21 == 0x08 && i_20_16 == 0x01) /* BC2T */
{
address_word offset = EXTEND16(i_15_0) << 2;
- if(vpe_busy) DELAY_SLOT(cia + 4 + offset);
+ if(vu0_busy()) DELAY_SLOT(cia + 4 + offset);
}
else if(i_25_21 == 0x08 && i_20_16 == 0x03) /* BC2TL */
{
address_word offset = EXTEND16(i_15_0) << 2;
- if(vpe_busy) DELAY_SLOT(cia + 4 + offset);
+ if(vu0_busy()) DELAY_SLOT(cia + 4 + offset);
else NULLIFY_NEXT_INSTRUCTION();
}
else if((i_25_21 == 0x02 && i_10_1 == 0x000) || /* CFC2 */
- (i_25_21 == 0x06 && i_10_1 == 0x000)) /* CTC2 */
+ (i_25_21 == 0x01)) /* QMFC2 */
{
int rt = i_20_16;
int id = i_15_11;
- int to_vu = (i_25_21 == 0x06); /* transfer direction */
address_word vu_cr_addr; /* VU control register address */
+ unsigned_4 data;
- if(interlock)
- while(vpe_busy)
- {
- vu0_issue(sd); /* advance one clock cycle */
- vpe_status = sim_core_read_aligned_4 (cpu, cia, read_map, VPE0_STAT);
- vpe_busy = vpe_status & 0x00000001;
- }
-
- /* compute VU register address */
- vu_cr_addr = VU0_MST + (id * 16);
-
- /* read or write word */
- if(to_vu) /* CTC2 */
+ /* interlock checking */
+ if(vu0_busy_in_macro_mode()) /* busy in macro mode */
{
- unsigned_4 data = GPR[rt];
- sim_core_write_aligned_4(cpu, cia, write_map, vu_cr_addr, data);
+ /* interlock bit invalid here */
+ if(interlock)
+ ; /* XXX: warning */
+
+ /* always check data hazard */
+ while(vu0_macro_hazard_check(id))
+ vu0_issue(sd);
}
- else /* CFC2 */
+ else if(vu0_busy_in_micro_mode() && interlock)
{
- unsigned_4 data = sim_core_read_aligned_4(cpu, cia, read_map, vu_cr_addr);
- GPR[rt] = EXTEND64(data);
+ while(vu0_busy_in_micro_mode())
+ vu0_issue(sd);
}
+
+ /* compute VU register address */
+ if(i_25_21 == 0x01) /* QMFC2 */
+ vu_cr_addr = VU0_VF00 + (id * 16);
+ else /* CFC2 */
+ vu_cr_addr = VU0_MST + (id * 16);
+
+ /* read or write word */
+ data = sim_core_read_aligned_4(cpu, cia, read_map, vu_cr_addr);
+ GPR[rt] = EXTEND64(data);
}
- else if((i_25_21 == 0x01) || /* QMFC2 */
- (i_25_21 == 0x05)) /* QMTC2 */
+ else if((i_25_21 == 0x06 && i_10_1 == 0x000) || /* CTC2 */
+ (i_25_21 == 0x05)) /* QMTC2 */
{
int rt = i_20_16;
int id = i_15_11;
- int to_vu = (i_25_21 == 0x05); /* transfer direction */
address_word vu_cr_addr; /* VU control register address */
+ unsigned_4 data;
- if(interlock)
- while(vpe_busy)
- {
- vu0_issue(sd); /* advance one clock cycle */
- vpe_status = sim_core_read_aligned_4 (cpu, cia, read_map, VPE0_STAT);
- vpe_busy = vpe_status & 0x00000001;
- }
-
- /* compute VU register address */
- vu_cr_addr = VU0_VF00 + (id * 16);
-
- /* read or write word */
- if(to_vu) /* CTC2 */
+ /* interlock checking */
+ if(vu0_busy_in_macro_mode()) /* busy in macro mode */
{
- unsigned_4 data = GPR[rt];
- sim_core_write_aligned_4(cpu, cia, write_map, vu_cr_addr, data);
+ /* interlock bit invalid here */
+ if(interlock)
+ ; /* XXX: warning */
+
+ /* always check data hazard */
+ while(vu0_macro_hazard_check(id))
+ vu0_issue(sd);
}
- else /* CFC2 */
+ else if(vu0_busy_in_micro_mode())
{
- unsigned_4 data = sim_core_read_aligned_4(cpu, cia, read_map, vu_cr_addr);
- GPR[rt] = EXTEND64(data);
+ if(interlock)
+ {
+ while(! vu0_micro_interlock_released())
+ vu0_issue(sd);
+ }
}
+
+ /* compute VU register address */
+ if(i_25_21 == 0x05) /* QMTC2 */
+ vu_cr_addr = VU0_VF00 + (id * 16);
+ else /* CTC2 */
+ vu_cr_addr = VU0_MST + (id * 16);
+
+ data = GPR[rt];
+ sim_core_write_aligned_4(cpu, cia, write_map, vu_cr_addr, data);
+ }
+ else if( 0 /* XXX: ... upper ... */)
+ {
+ unsigned_4 vu_upper, vu_lower;
+ vu_upper =
+ 0x00000000 | /* bits 31 .. 25 */
+ instruction & 0x01ffffff; /* bits 24 .. 0 */
+ vu_lower = 0x8000033c; /* NOP */
+
+ while(vu0_busy_in_micro_mode())
+ vu0_issue(sd);
+
+ vu0_macro_issue(vu_upper, vu_lower);
+ }
+ else if( 0 /* XXX: ... lower ... */)
+ {
+ unsigned_4 vu_upper, vu_lower;
+ vu_upper = 0x000002ff; /* NOP */
+ vu_lower =
+ 0x10000000 | /* bits 31 .. 25 */
+ instruction & 0x01ffffff; /* bits 24 .. 0 */
+
+ while(vu0_busy_in_micro_mode())
+ vu0_issue(sd);
+
+ vu0_macro_issue(vu_upper, vu_lower);
}
- /* other COP2 instructions */
+ /* XXX */
+ /* ... other COP2 instructions ... */
else
{
- SignalException(ReservedInstruction,instruction);
+ SignalException(ReservedInstruction, instruction);
/* NOTREACHED */
}
void cop_lw PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int coproc_num, int coproc_reg, unsigned int memword));
void cop_ld PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int coproc_num, int coproc_reg, uword64 memword));
-void cop_lq PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int coproc_num, int coproc_reg, unsigned128 memword));
unsigned int cop_sw PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int coproc_num, int coproc_reg));
uword64 cop_sd PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int coproc_num, int coproc_reg));
-unsigned128 cop_sq PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int coproc_num, int coproc_reg));
#define COP_LW(coproc_num,coproc_reg,memword) \
cop_lw (SD, CPU, cia, coproc_num, coproc_reg, memword)
#define COP_LD(coproc_num,coproc_reg,memword) \
cop_ld (SD, CPU, cia, coproc_num, coproc_reg, memword)
-#define COP_LQ(coproc_num,coproc_reg,memword) \
-cop_lq (SD, CPU, cia, coproc_num, coproc_reg, memword)
#define COP_SW(coproc_num,coproc_reg) \
cop_sw (SD, CPU, cia, coproc_num, coproc_reg)
#define COP_SD(coproc_num,coproc_reg) \
cop_sd (SD, CPU, cia, coproc_num, coproc_reg)
+
+/* start-sanitize-sky */
+void cop_lq PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int coproc_num, int coproc_reg, unsigned128 memword));
+unsigned128 cop_sq PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, int coproc_num, int coproc_reg));
+#define COP_LQ(coproc_num,coproc_reg,memword) \
+cop_lq (SD, CPU, cia, coproc_num, coproc_reg, memword)
#define COP_SQ(coproc_num,coproc_reg) \
cop_sq (SD, CPU, cia, coproc_num, coproc_reg)
+/* end-sanitize-sky */
void decode_coproc PARAMS ((SIM_DESC sd, sim_cpu *cpu, address_word cia, unsigned int instruction));
#define DecodeCoproc(instruction) \