📄 aal2rxrxbyte.c
字号:
Branch(ALWAYS, Upc + 1); /* Upc = 32 */ Bbus(IregsB(TEMP)); ALU(PassB); Abus(IregsA(UUI_IREG)); Actions(IregsAwrite); Branch(ALWAYS, Upc + 1); /* Upc = 33 */ /* Rotate UUI_IREG by 5 so that UUI moves into right position. * UUI_IREG(1:5) to UUI_IREG(4:0) */ Bbus(IregsB(UUI_IREG)); ALU(RotateB(5)); IregsA(UUI_IREG); Actions(IregsAwrite); Branch(ALWAYS, Upc + 1); /* Upc = 34 */ /* Its possible that we get Data9 in between the header */ Branch(Data9, Label(HANDLE_DATA9_IN_HEADER)); /* Upc = 30 */ /* The Data9 byte has to be removed from the FIFO *//* Test for pad bytes */LabelDef(TEST_FOR_PAD); DCPSIM_MESSAGE(Test for pad bytes); Bbus(IregsB(CID_IREG)); ALU(PassB); Branch(ALWAYS, Upc + 1); /* Upc = 35 */ Branch(ALUzero, Label(SET_DUMP_ALL)); /* Upc = 36 *//* Test for CRC5 of above header */LabelDef(TEST_FOR_CRC5); DCPSIM_MESSAGE(Test for CRC5 pass); Abus(Literal(0x1F)); Bbus(CRC5); ALU(AND); Branch(ALWAYS, Upc + 1); /* Upc = 39 */ Branch(ALUzero, Label(WRITE_PAYLOAD_TO_RC)); /* Upc = 40 */ /* If CRC5 failed set CRC5 error in the extract space */ DCPSIM_MESSAGE(CRC5 Failed); CregsAddrWrite(EXTRACT_SPACE_OFFSET(crc5Indicator)); Branch(ALWAYS, Upc+1); /* Upc = 50 */ CregInit(0x01); Branch(ALWAYS, Upc+1); /* Upc = 51 *//* Test for a partial packet or OSF byte. if OSF exists then reading of Corrupt cell can be resumed from OSF + 1. */LabelDef(TEST_FOR_PARTIAL_PACKET); DCPSIM_MESSAGE(Test for partial packet); IregCompareLit(PARTIAL_PAYLOAD_LEN, 0x00); Branch(ALWAYS, Upc+1); /* Upc = 41 */ BranchNot(ALUzero, Label(DISCARD_PAYLOAD)); /* Upc = 42 *//* Set the PPL to a high value such that discard takes place till Data9. Set the new cell flag */LabelDef(SET_DUMP_ALL); DCPSIM_MESSAGE(Dump rest of the data); IregInit(PARTIAL_PAYLOAD_LEN, 0x40, UseAbus); Branch(ALWAYS, Upc+1); /* Upc = 43 */ IregInit(NEW_CELL, 0x01, UseAbus); Branch(ALWAYS, Upc+1); /* Upc = 44 *//* Either drop PARTIAL_PAYLOAD_LEN bytes of data or * Stop dropping at Data9 arival.*/LabelDef(DISCARD_PAYLOAD); DCPSIM_MESSAGE(Discard the payload); IregSUBlit(PARTIAL_PAYLOAD_LEN, 0x03); Branch(ALWAYS, Upc + 1); /* Upc = 45 */ /* Convert PARTIAL_PAYLOAD_LEN to its negative */ Abus(Literal(0xFF)); Bbus(IregsB(PARTIAL_PAYLOAD_LEN)); ALU(SUB); IregsA(COUNTER); Actions(IregsAwrite); Branch(ALWAYS, Upc + 1); /* Upc = 45 */ //Actions(UnloadFIFO); //Branch(ALWAYS, Upc + 1); /* Upc = 45 */ /* Keep unloading FIFO and incrementing PARTIAL_PAYLOAD_LEN till * PARTIAL_PAYLOAD_LEN becomes all ones or a Data9 byte is got */LabelDef(DROP_DATA); Actions(IregIncr(COUNTER) + UnloadFIFO); Branch(ALWAYS, Upc + 1); /* Upc = 46 */ Branch(Data9, Label(SET_ERROR_IN_EXTRACT_SPACE)); /* Upc = 47 */ Branch(AllOnes(COUNTER), Label(SET_ERROR_IN_EXTRACT_SPACE)); /* Upc = 48 */ Branch(ALWAYS, Label(DROP_DATA)); /* Upc = 49 *//* Handle the CPS packet errors * Set CRC5 failure (-1) in the extract space.*/LabelDef(SET_ERROR_IN_EXTRACT_SPACE); DCPSIM_MESSAGE(Set error in extract space); CregsAddrWrite(EXTRACT_SPACE_OFFSET(goodCpsPacket)); Branch(ALWAYS, Upc+1); /* Upc = 50 */ CregInit(0x00); Branch(ALWAYS, Upc+1); /* Upc = 51 */ /* Write the address of extract space endOfCell to CREG and store New Cell Ireg in it. */ CregsAddrWrite(EXTRACT_SPACE_OFFSET(endOfCell)); IregToCregs(NEW_CELL); Branch(ALWAYS, Upc+1); /* Upc = 52 */ /* FOR DEBUGGING: * Using these lines one can check if the a proper header was * received in case of a packet error.*/ /* Write the address of extract space CID to CREG and store byte */ // THIS BEING ADDED FOR FIXING CRC5 PROBLEM ON HARDWARE // CregsAddrWrite(EXTRACT_SPACE_OFFSET(cid)); // IregToCregs(CID_IREG); // Branch(ALWAYS, Upc+1); /* Upc = 66 */ /* Write the address of extract space LI to CREG * and store the data */ // THIS BEING ADDED FOR FIXING CRC5 PROBLEM ON HARDWARE // CregsAddrWrite(EXTRACT_SPACE_OFFSET(li)); // IregToCregs(LI_IREG); // Branch(ALWAYS, Upc+1); /* Upc = 67 */ /* Write the UUI to the uui in extract space */ // THIS BEING ADDED FOR FIXING CRC5 PROBLEM ON HARDWARE // CregsAddrWrite(EXTRACT_SPACE_OFFSET(uui)); // IregToCregs(UUI_IREG); // Branch(ALWAYS, Upc+1); /* Upc = 68 *//* Reset the availabilty of the extract space so that RC can start processing * the data. */LabelDef(RELEASE_EXTRACT_SPACE); DCPSIM_MESSAGE(Release the extrace space); /* Set the extract avail flag, this should tell CPRC * when to read the extract space */ CregsAddrWrite(EXTRACT_SPACE_OFFSET(extractAvailFlag)); Branch(ALWAYS, Upc+1); /* Upc = 71 */ CregInit(0x01); Branch(ALWAYS, Upc+1); /* Upc = 72 */ /* Set the CPS header len and partial payload lenght to 0. */ IregInit(CPS_HEADER_LEN, 0x00, UseAbus); Branch(ALWAYS, Upc+1); /* Upc = 53 */ IregInit(PARTIAL_PAYLOAD_LEN, 0x00, UseAbus); Branch(ALWAYS, Upc+1); /* Upc = 54 */ /* Handover the extract space to the CPRC */ CregsAddrWrite(RXSTATUS); Branch(ALWAYS, Upc+1); /* Upc = 55 */ CregInit(0x80); Branch(ALWAYS, Upc+1); /* Upc = 56 */ Branch(AllOnes(COUNTER), Label(GO_TO_POLL_EXTRACT_SPACE)); BranchNot(Data9, Label(GO_TO_POLL_EXTRACT_SPACE)); /* Remove the last byte only after the extract space has been * released. Otherwise the unloadFIFO will block the processing. */ Actions(UnloadFIFO); Branch(ALWAYS, Upc+1); /* upc = */LabelDef(GO_TO_POLL_EXTRACT_SPACE); Branch(ALWAYS, Label(POLL_EXTRACT_SPACE)); /* Upc = 57 *//* Write data to the Extract space or till PARTIAL_PAYLOAD_LEN bytes * of data has been written or you get a Data9 from the FIFO */LabelDef(WRITE_PAYLOAD_TO_RC); Abus(Literal(0xFE)); Bbus(IregsB(LI_IREG)); ALU(SUB); IregsA(COUNTER); Actions(IregsAwrite + UnloadFIFO); Branch(ALWAYS, Upc + 1); /* Upc = 58 */ /* Initialize PARTIAL_PAYLOAD_LEN to 0, so that we can count the no. of * bytes sent to the CPRC */ IregInit(PARTIAL_PAYLOAD_LEN, 0x00, UseAbus); Branch(ALWAYS, Upc + 1); /* Upc = 59 */ Branch(Data9, Label(SEND_LAST_BYTE_OUT));/* Start unloading the data check for Data9 or counter */LabelDef(GET_DATA); Abus(Payload); ALU(PassA); Pbus(ALUout); Actions(UnloadFIFO + DataOutValid + IregIncr(COUNTER) + IregIncr(PARTIAL_PAYLOAD_LEN)); Branch(ALWAYS, Upc + 1); /* Upc = 59 */ Branch(Data9, Label(SEND_LAST_BYTE_OUT)); /* Upc = 61 */ Branch(AllOnes(COUNTER), Label(WRITE_TO_EXTRACT_SPACE)); /* Upc = 62 */ Branch(ALWAYS, Label(GET_DATA)); /* Upc = 63 *//* Remove the Data9 byte because of which control came here */LabelDef(SEND_LAST_BYTE_OUT); Branch(AllOnes(COUNTER), Label(WRITE_TO_EXTRACT_SPACE)); /* Upc = 62 */ Abus(Payload); ALU(PassA); Pbus(ALUout); Actions(DataOutValid + IregIncr(COUNTER) + IregIncr(PARTIAL_PAYLOAD_LEN)); Branch(ALWAYS, Upc+1); /* Upc = *//* In case the data transmission stopped due to Data9, then Set NEW_CELL byte to 1. */LabelDef(SET_NEW_CELL_FLAG); DCPSIM_MESSAGE(Set the new cell flag); IregInit(NEW_CELL, 0x01, UseAbus); Branch(ALWAYS, Upc+1); /* Upc = *//* Write CPS header bytes CID_IREG, LI_IREG and UUI_IREG to the * Extract space */LabelDef(WRITE_TO_EXTRACT_SPACE); DCPSIM_MESSAGE(Write data to the Extract space); /* Write the address of extract space CPS header length to CREG * and store the byte */ CregsAddrWrite(EXTRACT_SPACE_OFFSET(cpsHdrLen)); IregToCregs(CPS_HEADER_LEN); Branch(ALWAYS, Upc+1); /* Upc = 69 */ /* Write the address of extract space CPS payload length to CREG * and store the data */ CregsAddrWrite(EXTRACT_SPACE_OFFSET(cpsPayloadLen)); IregToCregs(PARTIAL_PAYLOAD_LEN); Branch(ALWAYS, Upc+1); /* Upc = 70 */ /* Write the address of extract space CID to CREG and store byte */ CregsAddrWrite(EXTRACT_SPACE_OFFSET(cid)); IregToCregs(CID_IREG); Branch(ALWAYS, Upc+1); /* Upc = 66 */ /* Write the address of extract space LI to CREG * and store the data */ CregsAddrWrite(EXTRACT_SPACE_OFFSET(li)); IregToCregs(LI_IREG); Branch(ALWAYS, Upc+1); /* Upc = 67 */ /* Write the UUI to the uui in extract space */ CregsAddrWrite(EXTRACT_SPACE_OFFSET(uui)); IregToCregs(UUI_IREG); Branch(ALWAYS, Upc+1); /* Upc = 68 */ /* Write the address of extract space endOfCell result to CREG * and store the data */ CregsAddrWrite(EXTRACT_SPACE_OFFSET(endOfCell)); IregToCregs(NEW_CELL); Branch(ALWAYS, Upc+1); /* Upc = 73 */ /* If CPS_HEADER_LEN == 3 and LI_IREG + 1 == PARTIAL_PAYLOAD_LEN then * Set cpsPckComplete to 0x01. */ Abus(IregsA(CPS_HEADER_LEN)); Bbus(Literal(0x03)); ALU(SUB); Branch(ALWAYS, Upc+1); BranchNot(ALUzero, Label(RELEASE_EXTRACT_SPACE)); Abus(Literal(0x01)); Bbus(IregsB(LI_IREG)); ALU(ADD); IregsA(TEMP); Actions(IregsAwrite); Branch(ALWAYS, Upc+1); Abus(IregsA(TEMP)); Bbus(IregsB(PARTIAL_PAYLOAD_LEN)); ALU(XOR); Branch(ALWAYS, Upc+1); BranchNot(ALUzero, Label(RELEASE_EXTRACT_SPACE)); /* Upc = 74 */ /* This is an exact match for the CPS packet */ CregsAddrWrite(EXTRACT_SPACE_OFFSET(cpsPckComplete)); Branch(ALWAYS, Upc+1); /* Upc = 50 */ CregInit(0x01); Branch(ALWAYS, Upc+1); /* Upc = 51 */ /* Always go to RELEASE_EXTRACT_SPACE from here */ Branch(ALWAYS, Label(RELEASE_EXTRACT_SPACE)); /* Upc = 74 *//* Write data to the Extract space or till PARTIAL_PAYLOAD_LEN bytes * of data has been written or you get a Data9 from the FIFO */LabelDef(WRITE_PART_PAYLOAD_TO_RC); Abus(Literal(0xFF)); Bbus(IregsB(PARTIAL_PAYLOAD_LEN)); ALU(SUB); IregsA(COUNTER); Actions(IregsAwrite + UnloadFIFO); Branch(ALWAYS, Upc + 1); /* Upc = 58 */ /* Initialize PARTIAL_PAYLOAD_LEN to 0, so that we can count the no. of * bytes sent to the CPRC */ IregInit(PARTIAL_PAYLOAD_LEN, 0x00, UseAbus); Branch(ALWAYS, Upc + 1); /* Upc = 58 */ Branch(ALWAYS, Label(GET_DATA)); /* Upc = 59 */LabelDef(HANDLE_DATA9_IN_HEADER); /* Four things have to be taken care off * 1. CRC5 check needs to be done. * 2. padding check needs to be done. * 3. Set new cell indication. * 4. Data9 has to be removed from the FIFO * on releasing extract space.*/ IregInit(NEW_CELL, 0x01, UseAbus); Branch(ALWAYS, Upc+1); /* Upc = */ Bbus(IregsB(CID_IREG)); ALU(PassB); Branch(ALWAYS, Upc + 1); /* Upc = 35 */ Branch(ALUzero, Label(SET_ERROR_IN_EXTRACT_SPACE)); /* Upc = 36 */ /* Only if the header length is 3 do the CRC5 check */ Abus(Literal(0x03)); Bbus(IregsB(CPS_HEADER_LEN)); ALU(SUB); Branch(ALWAYS, Upc + 1); BranchNot(ALUzero, Label(WRITE_TO_EXTRACT_SPACE)); DCPSIM_MESSAGE(Test for CRC5 on patial packet); Abus(Literal(0x1F)); Bbus(CRC5); ALU(AND); Branch(ALWAYS, Upc + 1); Branch(ALUzero, Label(WRITE_TO_EXTRACT_SPACE)); /* Upc = 36 */ /* If CRC5 failed set CRC5 error in the extract space * also set the bad CPS packet indication */ DCPSIM_MESSAGE(CRC5 Failed); CregsAddrWrite(EXTRACT_SPACE_OFFSET(crc5Indicator)); Branch(ALWAYS, Upc+1); /* Upc = 50 */ CregInit(0x01); Branch(ALWAYS, Upc+1); /* Upc = 51 */ Branch(ALWAYS, Label(SET_ERROR_IN_EXTRACT_SPACE)); /* Upc = 36 */}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -