void test_sra() { printf("===test SRA===\n"); struct cpu_struct cpu; memset(&cpu, 0, sizeof(cpu)); cpu.current_ins.rt = 1; cpu.current_ins.rd = 2; cpu.current_ins.shamt = 3; cpu.current_ins.funct = 0x03; cpu.reg[1] = 0x80000000; r_type(&cpu); printf("%s\n", word_to_binary(cpu.reg[1], 0, 31)); printf("%s\n", word_to_binary(cpu.reg[2], 0, 31)); assert(cpu.reg[2] == 0xf0000000); printf("pass\n\n"); }
void cmd_reg(void) { #if (BOARD_TYPE == AUAV3_BOARD) printf("USB Registers:\r\n"); printf("\tU1OTGSTAT = %s\r\n", word_to_binary(U1OTGSTAT)); printf("\tU1OTGCON = %s\r\n", word_to_binary(U1OTGCON)); printf("\tU1STAT = %s\r\n", word_to_binary(U1STAT)); printf("\tU1CON = %s\r\n", word_to_binary(U1CON)); printf("\tU1CNFG1 = %s\r\n", word_to_binary(U1CNFG1)); printf("\tU1CNFG2 = %s\r\n", word_to_binary(U1CNFG2)); printf("\tU1OTGIR = %s\r\n", word_to_binary(U1OTGIR)); printf("\tU1OTGIE = %s\r\n", word_to_binary(U1OTGIE)); printf("IC Registers:\r\n"); printf("\tIC1CON1 = %s %04x\r\n", word_to_binary(IC1CON1), IC1CON1); printf("\tIC1CON2 = %s %04x\r\n", word_to_binary(IC1CON2), IC1CON2); printf("\tIC2CON1 = %s %04x\r\n", word_to_binary(IC2CON1), IC2CON1); printf("\tIC2CON2 = %s %04x\r\n", word_to_binary(IC2CON2), IC2CON2); #endif // BOARD_TYPE /* UxOTGSTAT: USB OTG STATUS REGISTER VBUSVD: A-VBUS Valid Indicator bit 1 = The VBUS voltage is above VA_VBUS_VLD (as defined in the USB OTG Specification) on the A device 0 = The VBUS voltage is below VA_VBUS_VLD on the A device UxOTGCON: USB ON-THE-GO CONTROL REGISTER bit 3 VBUSON: VBUS Power-on bit(1) 1 = VBUS line is powered 0 = VBUS line is not powered UxCNFG2: USB CONFIGURATION REGISTER 2 */ }