static tU08 transferByte_U08(tU08 data_U08, tU08 instruction_U08) { tU08 i_U08; tU08 byteRead_U08 = 0; /* first bit is zero */ SDI_LO; SII_LO; clockit(); for (i_U08 = 0; i_U08 < 8; i_U08++) { /* read one bit form SDO */ byteRead_U08 <<= 1; // shift one bit, this clears LSB if (GET_STATUS(COIO_SDO_CFG) != 0) { byteRead_U08 |= 1; } /* output next data bit on SDI */ if (data_U08 & 0x80) { SDI_HI; } else { SDI_LO; } /* output next instruction bit on SII */ if (instruction_U08 & 0x80) { SII_HI; } else { SII_LO; } clockit(); /* prepare for processing next bit */ data_U08 <<= 1; instruction_U08 <<= 1; } /* Last two bits are zero */ SDI_LO; SII_LO; clockit(); clockit(); return byteRead_U08; }
int main (int argc, char *argv[]) { topp = new VM_PREFIX; topp->check = 0; clockit(0,0); Verilated::debug(0); for (int i = 0; i < 2; i++) { clockit(0, 0); clockit(0, 1); clockit(1, 1); clockit(0, 0); clockit(1, 1); clockit(1, 0); clockit(0, 0); } topp->check = 1; clockit(0,0); }