Line 1... |
Line 1... |
//+FHDR------------------------------------------------------------------------
|
|
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
|
|
//GLADIC Open Source RTL
|
|
//-----------------------------------------------------------------------------
|
|
//FILE NAME :
|
|
//DEPARTMENT : IC Design / Verification
|
|
//AUTHOR : Felipe Fernandes da Costa
|
|
//AUTHOR’S EMAIL :
|
|
//-----------------------------------------------------------------------------
|
|
//RELEASE HISTORY
|
|
//VERSION DATE AUTHOR DESCRIPTION
|
|
//1.0 YYYY-MM-DD name
|
|
//-----------------------------------------------------------------------------
|
|
//KEYWORDS : General file searching keywords, leave blank if none.
|
|
//-----------------------------------------------------------------------------
|
|
//PURPOSE : ECSS_E_ST_50_12C_31_july_2008
|
|
//-----------------------------------------------------------------------------
|
|
//PARAMETERS
|
|
//PARAM NAME RANGE : DESCRIPTION : DEFAULT : UNITS
|
|
//e.g.DATA_WIDTH [32,16] : width of the DATA : 32:
|
|
//-----------------------------------------------------------------------------
|
|
//REUSE ISSUES
|
|
//Reset Strategy :
|
|
//Clock Domains :
|
|
//Critical Timing :
|
|
//Test Features :
|
|
//Asynchronous I/F :
|
|
//Scan Methodology :
|
|
//Instantiations :
|
|
//Synthesizable (y/n) :
|
|
//Other :
|
|
//-FHDR------------------------------------------------------------------------
|
|
|
|
#ifndef SPW_TX_T_H
|
#ifndef SPW_TX_T_H
|
#define SPW_TX_T_H
|
#define SPW_TX_T_H
|
|
|
#define START 0
|
#define START 0
|
#define SEND_NULL 1
|
#define SEND_NULL_START 1
|
#define SEND_FCT_NULL 2
|
#define SEND_FCT_START 2
|
#define SEND_TIME_CODE_FCT_NCHAR_NULL 3
|
#define SEND_NULL 3
|
|
#define SEND_FCT 4
|
|
#define SEND_NCHAR 5
|
|
#define SEND_TIMEC 6
|
|
|
#define TYPE_TIMECODE 4
|
#define TYPE_TIMECODE 4
|
#define TYPE_FCT 5
|
#define TYPE_FCT 5
|
#define TYPE_NCHAR_EOP_EEP 6
|
#define TYPE_NCHAR 6
|
#define TYPE_NULL 7
|
#define TYPE_EOP_EEP 7
|
|
#define TYPE_NULL 8
|
|
|
class SPW_TX_SC;
|
class SPW_TX_SC;
|
|
|
SC_MODULE(SPW_TX_SC)
|
SC_MODULE(SPW_TX_SC)
|
{
|
{
|
Line 79... |
Line 50... |
sc_uint<9> TXDATA_FLAGCTRL_TX_AUX;
|
sc_uint<9> TXDATA_FLAGCTRL_TX_AUX;
|
sc_uint<9> TXDATA_FLAGCTRL_TX_LAST;
|
sc_uint<9> TXDATA_FLAGCTRL_TX_LAST;
|
|
|
sc_uint<8> LAST_TIMEIN_CONTROL_FLAG_TX;
|
sc_uint<8> LAST_TIMEIN_CONTROL_FLAG_TX;
|
|
|
|
sc_uint<8> NULL_TOKEN;
|
|
sc_uint<4> FCT_TOKEN;
|
|
sc_uint<9> DATA_TOKEN;
|
|
sc_uint<14> TIMEC_TOKEN;
|
|
|
|
sc_uint<14> ALL_TOKEN;
|
|
|
sc_uint<4> state_tx;
|
sc_uint<4> state_tx;
|
|
|
|
|
|
sc_signal<bool> enable_null;
|
|
sc_signal<bool> enable_fct;
|
|
sc_signal<bool> enable_time_code;
|
|
sc_signal<bool> enable_n_char;
|
|
|
bool first_time;
|
bool first_time;
|
bool working;
|
bool working;
|
|
|
unsigned int last_type;
|
unsigned int last_type;
|
unsigned int COUNTER;
|
unsigned int COUNTER;
|
Line 119... |
Line 103... |
FCT_COUNTER = 0;
|
FCT_COUNTER = 0;
|
counter_first_time = 0;
|
counter_first_time = 0;
|
//FCT_SEND = 0;
|
//FCT_SEND = 0;
|
|
|
last_type = TYPE_NULL;
|
last_type = TYPE_NULL;
|
NULL_S[7] = 0;
|
|
NULL_S[6] = 1;
|
|
NULL_S[5] = 1;
|
|
NULL_S[4] = 1;
|
|
NULL_S[3] = 0;
|
|
NULL_S[2] = 1;
|
|
NULL_S[1] = 0;
|
|
NULL_S[0] = 0;
|
|
|
|
FCT[3] = 0;
|
|
FCT[2] = 1;
|
|
FCT[1] = 0;
|
|
FCT[0] = 0;
|
|
|
|
TIME_CODE[13] = 0;
|
|
TIME_CODE[12] = 1;
|
|
TIME_CODE[11] = 1;
|
|
TIME_CODE[10] = 1;
|
|
TIME_CODE[9] = 1;
|
|
TIME_CODE[8] = 0;
|
|
TIME_CODE[7] = 0;
|
|
TIME_CODE[6] = 0;
|
|
TIME_CODE[5] = 0;
|
|
TIME_CODE[4] = 0;
|
|
TIME_CODE[3] = 0;
|
|
TIME_CODE[2] = 0;
|
|
TIME_CODE[1] = 0;
|
|
TIME_CODE[0] = 0;
|
|
|
|
EOP[3] = 0;
|
|
EOP[2] = 1;
|
|
EOP[1] = 0;
|
|
EOP[0] = 1;
|
|
|
|
EEP[3] = 0;
|
|
EEP[2] = 1;
|
|
EEP[1] = 1;
|
|
EEP[0] = 0;
|
|
|
|
first_time = true;
|
first_time = true;
|
enable_null = false;
|
enable_null = false;
|
enable_fct = false;
|
enable_fct = false;
|
enable_time_code = false;
|
enable_time_code = false;
|
Line 174... |
Line 120... |
{
|
{
|
case START:
|
case START:
|
|
|
if(SEND_NULL_TX && ENABLE_TX)
|
if(SEND_NULL_TX && ENABLE_TX)
|
{
|
{
|
state_tx = SEND_NULL;
|
enable_null = true;
|
|
enable_fct = false;
|
|
enable_time_code = false;
|
|
enable_n_char = false;
|
|
state_tx = SEND_NULL_START;
|
}
|
}
|
break;
|
break;
|
case SEND_NULL:
|
case SEND_NULL_START:
|
|
|
enable_null = true;
|
enable_null = true;
|
enable_fct = false;
|
enable_fct = false;
|
state_tx = SEND_NULL;
|
enable_time_code = false;
|
|
enable_n_char = false;
|
|
|
|
state_tx = SEND_NULL_START;
|
last_type = TYPE_NULL;
|
last_type = TYPE_NULL;
|
|
|
if(SEND_NULL_TX && SEND_FCT_TX && ENABLE_TX && counter_first_time > 0)
|
if(SEND_NULL_TX && SEND_FCT_TX && ENABLE_TX && counter_first_time > 0)
|
{
|
{
|
state_tx = SEND_FCT_NULL;
|
if(COUNTER == 7)
|
|
{
|
|
state_tx = SEND_FCT_START;
|
|
}
|
//cout << enable_fct << endl;
|
//cout << enable_fct << endl;
|
}
|
}
|
break;
|
break;
|
case SEND_FCT_NULL:
|
case SEND_FCT_START:
|
|
|
|
enable_null = false;
|
|
enable_fct = true;
|
|
enable_time_code = false;
|
|
enable_n_char = false;
|
|
|
state_tx = SEND_FCT_NULL;
|
if(COUNTER == 3)
|
|
FCT_SEND = FCT_SEND - 1;
|
|
|
if(SEND_FCT_TX && FCT_COUNTER -1 > 0)
|
if(SEND_FCT_TX && FCT_SEND > 0)
|
{
|
{
|
state_tx = SEND_TIME_CODE_FCT_NCHAR_NULL;
|
state_tx = SEND_FCT_START;
|
}else if(SEND_FCT_TX && FCT_SEND > 0 && enable_null == false)
|
}
|
|
else
|
{
|
{
|
enable_fct = true;
|
if(FCT_SEND == 0)
|
}else if(SEND_FCT_TX && enable_fct == false && FCT_SEND == 0)
|
state_tx = SEND_NULL;
|
|
}
|
|
|
|
//cout << enable_null << " " << enable_fct << endl;
|
|
break;
|
|
case SEND_NULL:
|
|
|
|
if(COUNTER == 7)
|
|
{
|
|
if(TICKIN_TX)
|
|
{
|
|
state_tx = SEND_TIMEC;
|
|
}else if(FCT_SEND > 0)
|
|
{
|
|
state_tx = SEND_FCT;
|
|
}else if(TXWRITE_TX && FCT_COUNTER > 0)
|
|
{
|
|
state_tx = SEND_NCHAR;
|
|
}else
|
|
{
|
|
state_tx = SEND_NULL;
|
|
}
|
|
}
|
|
else
|
{
|
{
|
enable_null = true;
|
enable_null = true;
|
|
enable_fct = false;
|
|
enable_time_code = false;
|
|
enable_n_char = false;
|
}
|
}
|
//cout << enable_null << " " << enable_fct << endl;
|
|
break;
|
break;
|
case SEND_TIME_CODE_FCT_NCHAR_NULL:
|
case SEND_FCT:
|
if(TICKIN_TX && enable_n_char == false && enable_fct == false && enable_null == false)
|
if(COUNTER == 3)
|
{
|
{
|
enable_time_code = true;
|
|
}else if(FCT_SEND > 0 && enable_n_char == false && enable_time_code == false && enable_null == false)
|
FCT_SEND = FCT_SEND - 1;
|
|
|
|
if(TICKIN_TX)
|
|
{
|
|
state_tx = SEND_TIMEC;
|
|
}else if(FCT_SEND > 0)
|
|
{
|
|
state_tx = SEND_FCT;
|
|
}else if(TXWRITE_TX && FCT_COUNTER > 0)
|
|
{
|
|
state_tx = SEND_NCHAR;
|
|
}else
|
|
{
|
|
state_tx = SEND_NULL;
|
|
}
|
|
}
|
|
else
|
{
|
{
|
|
enable_null = false;
|
enable_fct = true;
|
enable_fct = true;
|
}else if(TXWRITE_TX && FCT_COUNTER-1 > 0 && enable_fct == false && enable_time_code == false && enable_null == false)
|
enable_time_code = false;
|
|
enable_n_char = false;
|
|
}
|
|
break;
|
|
case SEND_NCHAR:
|
|
|
|
if(TXDATA_FLAGCTRL_TX_AUX[8])
|
|
{
|
|
if(COUNTER == 3)
|
|
{
|
|
FCT_COUNTER = FCT_COUNTER - 1;
|
|
|
|
if(TICKIN_TX)
|
|
{
|
|
state_tx = SEND_TIMEC;
|
|
}else if(TXWRITE_TX && FCT_COUNTER > 0)
|
|
{
|
|
state_tx = SEND_NCHAR;
|
|
}else
|
|
{
|
|
state_tx = SEND_NULL;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(COUNTER == 9)
|
|
{
|
|
FCT_COUNTER = FCT_COUNTER - 1;
|
|
|
|
if(TICKIN_TX)
|
|
{
|
|
state_tx = SEND_TIMEC;
|
|
}else if(TXWRITE_TX && FCT_COUNTER > 0)
|
|
{
|
|
state_tx = SEND_NCHAR;
|
|
}else
|
{
|
{
|
|
state_tx = SEND_NULL;
|
|
}
|
|
}
|
|
}
|
|
|
|
enable_null = false;
|
|
enable_fct = false;
|
|
enable_time_code = false;
|
enable_n_char = true;
|
enable_n_char = true;
|
}else if(enable_fct == false && enable_time_code == false && enable_n_char == false)
|
break;
|
|
case SEND_TIMEC:
|
|
if(COUNTER == 13)
|
{
|
{
|
enable_null = true;
|
if(TICKIN_TX)
|
|
{
|
|
state_tx = SEND_TIMEC;
|
|
}else if(FCT_SEND > 0)
|
|
{
|
|
state_tx = SEND_FCT;
|
|
}else if(TXWRITE_TX && FCT_COUNTER > 0)
|
|
{
|
|
state_tx = SEND_NCHAR;
|
|
}else
|
|
{
|
|
state_tx = SEND_NULL;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
enable_null = false;
|
|
enable_fct = false;
|
|
enable_time_code = true;
|
|
enable_n_char = false;
|
}
|
}
|
break;
|
break;
|
}
|
}
|
}
|
}
|
}
|
}
|
Line 234... |
Line 306... |
}
|
}
|
else
|
else
|
{
|
{
|
if(SEND_FCT_TX && GOTFCT_TX)
|
if(SEND_FCT_TX && GOTFCT_TX)
|
{
|
{
|
|
if(FCT_COUNTER < 49)
|
FCT_COUNTER = FCT_COUNTER +8;
|
FCT_COUNTER = FCT_COUNTER +8;
|
|
else
|
|
FCT_COUNTER = FCT_COUNTER + 7;
|
//cout << "DATA TO SEND" << " " << FCT_COUNTER <<endl;
|
//cout << "DATA TO SEND" << " " << FCT_COUNTER <<endl;
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
Line 255... |
Line 330... |
//cout << "DATA RECEIVED" <<endl;
|
//cout << "DATA RECEIVED" <<endl;
|
}
|
}
|
}
|
}
|
}
|
}
|
|
|
void ALL_HERE()
|
|
|
void PROCESS_DATA()
|
{
|
{
|
if(RESET_TX)
|
if(RESET_TX)
|
{
|
{
|
|
|
|
COUNTER = 0;
|
|
|
DOUT = 0;
|
DOUT = 0;
|
SOUT = 0;
|
SOUT = 0;
|
|
|
|
DOUT_LAST = 0;
|
|
|
|
NULL_TOKEN[7] = 0;
|
|
NULL_TOKEN[6] = 0;
|
|
NULL_TOKEN[5] = 1;
|
|
NULL_TOKEN[4] = 0;
|
|
NULL_TOKEN[3] = 1;
|
|
NULL_TOKEN[2] = 1;
|
|
NULL_TOKEN[1] = 1;
|
|
NULL_TOKEN[0] = 0;
|
|
|
|
FCT_TOKEN[3] = 0;
|
|
FCT_TOKEN[2] = 0;
|
|
FCT_TOKEN[1] = 1;
|
|
FCT_TOKEN[0] = 0;
|
|
|
|
DATA_TOKEN;
|
|
|
|
TIMEC_TOKEN[13] = 0;
|
|
TIMEC_TOKEN[12] = 0;
|
|
TIMEC_TOKEN[11] = 0;
|
|
TIMEC_TOKEN[10] = 0;
|
|
TIMEC_TOKEN[9] = 0;
|
|
TIMEC_TOKEN[8] = 0;
|
|
TIMEC_TOKEN[7] = 0;
|
|
TIMEC_TOKEN[6] = 0;
|
|
TIMEC_TOKEN[5] = 0;
|
|
TIMEC_TOKEN[4] = 0;
|
|
TIMEC_TOKEN[3] = 1;
|
|
TIMEC_TOKEN[2] = 1;
|
|
TIMEC_TOKEN[1] = 1;
|
|
TIMEC_TOKEN[0] = 0;
|
|
|
}
|
}
|
else
|
else
|
{
|
{
|
|
|
READY_TX = false;
|
READY_TX = false;
|
READY_TICK = false;
|
READY_TICK = false;
|
EEP_EOP = false;
|
EEP_EOP = false;
|
if(enable_null)//
|
|
{
|
if(SEND_NULL_TX)
|
if(COUNTER == 0)
|
|
{
|
|
if(first_time)
|
|
{
|
|
DOUT_LAST=DOUT = NULL_S[7];
|
|
SOUT=!SOUT;
|
|
}else if(last_type == TYPE_NULL)
|
|
{
|
|
if(DOUT == !(NULL_S[6]^NULL_S[0]^NULL_S[1]))
|
|
{
|
|
DOUT = !(NULL_S[6]^NULL_S[0]^NULL_S[1]);
|
|
SOUT=!SOUT;
|
|
}else
|
|
{
|
{
|
DOUT = !(NULL_S[6]^NULL_S[0]^NULL_S[1]);
|
|
SOUT=SOUT;
|
|
}
|
|
|
|
}else if(last_type == TYPE_FCT)
|
//if(TXWRITE_TX && COUNTER == 0)
|
|
TXDATA_FLAGCTRL_TX_AUX = TXDATA_FLAGCTRL_TX;
|
|
//else
|
|
// TXDATA_FLAGCTRL_TX_AUX = TXDATA_FLAGCTRL_TX_AUX;
|
|
|
|
//if(TXWRITE_TX && COUNTER == 5)
|
|
// READY_TX = true;
|
|
|
|
if(enable_null)
|
{
|
{
|
if(DOUT == !(NULL_S[6]^FCT[0]^FCT[1]))
|
ALL_TOKEN = (0,NULL_TOKEN);
|
|
}else if(enable_fct)
|
{
|
{
|
DOUT = !(NULL_S[6]^FCT[0]^FCT[1]);
|
ALL_TOKEN = (0,FCT_TOKEN);
|
SOUT=!SOUT;
|
}else if(enable_time_code)
|
}else
|
|
{
|
{
|
DOUT = !(NULL_S[6]^FCT[0]^FCT[1]);
|
ALL_TOKEN = TIMEC_TOKEN;
|
SOUT=SOUT;
|
}else if(enable_n_char)
|
|
{
|
|
ALL_TOKEN = (0,TXDATA_FLAGCTRL_TX_AUX.range(7,0),TXDATA_FLAGCTRL_TX_AUX[8],0);
|
}
|
}
|
|
|
}else if(last_type == TYPE_NCHAR_EOP_EEP)
|
if(COUNTER == 0)
|
{
|
|
if(TXDATA_FLAGCTRL_TX_LAST[8] == 1)
|
|
{
|
{
|
EEP_EOP = true;
|
if(last_type == TYPE_NULL || last_type == TYPE_FCT)
|
if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 0)
|
|
{
|
{
|
if(DOUT == !(NULL_S[6]^EOP[0]^EOP[1]))
|
if(DOUT == !(ALL_TOKEN[1]^0))
|
{
|
{
|
SOUT=!SOUT;
|
SOUT=!SOUT;
|
}
|
}
|
else
|
else
|
{
|
{
|
SOUT=SOUT;
|
SOUT=SOUT;
|
}
|
}
|
DOUT = !(NULL_S[6]^EOP[0]^EOP[1]);
|
|
}else if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 1)
|
DOUT = !(ALL_TOKEN[1]^0);
|
|
|
|
}else if(last_type == TYPE_NCHAR)
|
{
|
{
|
if(DOUT == !(NULL_S[6]^EEP[0]^EEP[1]))
|
|
|
if(DOUT == !(ALL_TOKEN[1]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]))
|
{
|
{
|
SOUT=!SOUT;
|
SOUT=!SOUT;
|
}
|
}
|
else
|
else
|
{
|
{
|
SOUT=SOUT;
|
SOUT=SOUT;
|
}
|
}
|
DOUT = !(NULL_S[6]^EEP[0]^EEP[1]);
|
|
}
|
DOUT = !(ALL_TOKEN[1]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]);
|
}
|
}
|
else
|
else if(last_type == TYPE_EOP_EEP)
|
{
|
{
|
if(DOUT == !(NULL_S[6]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]))
|
|
|
if(DOUT == !(ALL_TOKEN[1]^1))
|
{
|
{
|
DOUT = !(NULL_S[6]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]);
|
|
SOUT=!SOUT;
|
SOUT=!SOUT;
|
}else
|
|
{
|
|
DOUT = !(NULL_S[6]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]);
|
|
SOUT=SOUT;
|
|
}
|
|
}
|
}
|
}else if(last_type == TYPE_TIMECODE)
|
|
{
|
|
if(DOUT == !(NULL_S[6]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]))
|
|
SOUT=!SOUT;
|
|
else
|
else
|
SOUT=SOUT;
|
|
|
|
DOUT = !(NULL_S[6]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]);
|
|
}
|
|
}
|
|
else if(COUNTER == 1)
|
|
{
|
|
if(DOUT == NULL_S[6])
|
|
{
|
|
SOUT=!SOUT;
|
|
DOUT = NULL_S[6];
|
|
}else
|
|
{
|
{
|
SOUT=SOUT;
|
SOUT=SOUT;
|
DOUT = NULL_S[6];
|
|
}
|
|
}
|
}
|
else if(COUNTER == 2)
|
|
|
DOUT = !(ALL_TOKEN[1]^1);
|
|
}else if(last_type == TYPE_TIMECODE)
|
{
|
{
|
if(DOUT == NULL_S[5])
|
|
|
if(DOUT == !(ALL_TOKEN[1]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]))
|
{
|
{
|
SOUT=!SOUT;
|
SOUT=!SOUT;
|
DOUT = NULL_S[5];
|
|
}else
|
|
{
|
|
SOUT=SOUT;
|
|
DOUT = NULL_S[5];
|
|
}
|
}
|
}
|
else
|
else if(COUNTER == 3)
|
|
{
|
|
if(DOUT == NULL_S[4])
|
|
{
|
|
SOUT=!SOUT;
|
|
DOUT = NULL_S[4];
|
|
}else
|
|
{
|
{
|
SOUT=SOUT;
|
SOUT=SOUT;
|
DOUT = NULL_S[4];
|
|
}
|
}
|
|
|
|
DOUT = !(ALL_TOKEN[1]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]);
|
}
|
}
|
else if(COUNTER == 4)
|
|
{
|
COUNTER++;
|
if(DOUT == NULL_S[3])
|
|
{
|
|
SOUT=!SOUT;
|
|
DOUT = NULL_S[3];
|
|
}else
|
|
{
|
|
SOUT=SOUT;
|
|
DOUT = NULL_S[3];
|
|
}
|
|
}
|
}
|
else if(COUNTER == 5)
|
else
|
{
|
|
if(DOUT == NULL_S[2])
|
|
{
|
|
SOUT=!SOUT;
|
|
DOUT = NULL_S[2];
|
|
}else
|
|
{
|
{
|
SOUT=SOUT;
|
if(enable_null)
|
DOUT = NULL_S[2];
|
|
}
|
|
}
|
|
else if(COUNTER == 6)
|
|
{
|
{
|
if(DOUT == NULL_S[1])
|
if(DOUT == ALL_TOKEN[COUNTER])
|
{
|
{
|
SOUT=!SOUT;
|
SOUT=!SOUT;
|
DOUT = NULL_S[1];
|
|
}else
|
|
{
|
|
SOUT=SOUT;
|
|
DOUT = NULL_S[1];
|
|
}
|
|
}
|
}
|
else if(COUNTER == 7)
|
else
|
{
|
|
if(DOUT == NULL_S[0])
|
|
{
|
|
SOUT=!SOUT;
|
|
DOUT = NULL_S[0];
|
|
}else
|
|
{
|
{
|
SOUT=SOUT;
|
SOUT=SOUT;
|
DOUT = NULL_S[0];
|
|
}
|
|
}
|
}
|
|
|
first_time = false;
|
DOUT = ALL_TOKEN[COUNTER];
|
COUNTER++;
|
|
|
|
if(COUNTER == 8)
|
if(COUNTER == 7)
|
{
|
{
|
COUNTER = 0;
|
COUNTER = 0;
|
enable_null = false;
|
|
last_type = TYPE_NULL;
|
last_type = TYPE_NULL;
|
|
|
if(state_tx == SEND_NULL)
|
if(state_tx == SEND_NULL_START)
|
counter_first_time = counter_first_time + 1;
|
counter_first_time = counter_first_time + 1;
|
}
|
}
|
|
else
|
}else if(enable_fct)//
|
|
{
|
|
|
|
if(COUNTER == 0)
|
|
{
|
{
|
if(last_type == TYPE_NULL)
|
COUNTER++;
|
|
}
|
|
}else if(enable_fct)
|
{
|
{
|
if(DOUT == !(FCT[2]^NULL_S[0]^NULL_S[1]))
|
|
|
if(DOUT == ALL_TOKEN[COUNTER])
|
{
|
{
|
SOUT=!SOUT;
|
SOUT=!SOUT;
|
}
|
}
|
else
|
else
|
{
|
{
|
SOUT=SOUT;
|
SOUT=SOUT;
|
}
|
}
|
DOUT = !(FCT[2]^NULL_S[0]^NULL_S[1]);
|
|
}else if(last_type == TYPE_FCT)
|
DOUT = ALL_TOKEN[COUNTER];
|
{
|
|
if(DOUT == !(FCT[2]^FCT[0]^FCT[1]))
|
if(COUNTER == 3)
|
{
|
{
|
SOUT=!SOUT;
|
COUNTER = 0;
|
|
last_type = TYPE_FCT;
|
}
|
}
|
else
|
else
|
{
|
{
|
SOUT=SOUT;
|
COUNTER++;
|
}
|
}
|
DOUT = !(FCT[2]^FCT[0]^FCT[1]);
|
}else if(enable_time_code)
|
}else if(last_type == TYPE_NCHAR_EOP_EEP)
|
|
{
|
{
|
if(TXDATA_FLAGCTRL_TX_LAST[8] == 1)
|
if(DOUT == ALL_TOKEN[COUNTER])
|
{
|
|
EEP_EOP = true;
|
|
if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 0)
|
|
{
|
|
if(DOUT == !(FCT[2]^EOP[0]^EOP[1]))
|
|
{
|
{
|
SOUT=!SOUT;
|
SOUT=!SOUT;
|
}
|
}
|
else
|
else
|
{
|
{
|
SOUT=SOUT;
|
SOUT=SOUT;
|
}
|
}
|
DOUT = !(FCT[2]^EOP[0]^EOP[1]);
|
|
}else if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 1)
|
DOUT = ALL_TOKEN[COUNTER];
|
{
|
|
if(DOUT == !(FCT[2]^EEP[0]^EEP[1]))
|
if(COUNTER == 13)
|
{
|
{
|
SOUT=!SOUT;
|
COUNTER = 0;
|
|
READY_TICK = true;
|
|
last_type = TYPE_TIMECODE;
|
|
LAST_TIMEIN_CONTROL_FLAG_TX = TIMEIN_CONTROL_FLAG_TX;
|
}
|
}
|
else
|
else
|
{
|
{
|
SOUT=SOUT;
|
COUNTER++;
|
}
|
|
DOUT = !(FCT[2]^EEP[0]^EEP[1]);
|
|
}
|
|
}
|
}
|
else
|
}else if(enable_n_char)
|
{
|
{
|
if(DOUT == !(FCT[2]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]))
|
|
|
if(DOUT == ALL_TOKEN[COUNTER])
|
{
|
{
|
SOUT=!SOUT;
|
SOUT=!SOUT;
|
}
|
}
|
else
|
else
|
{
|
{
|
SOUT=SOUT;
|
SOUT=SOUT;
|
}
|
}
|
DOUT = !(FCT[2]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]);
|
|
}
|
DOUT = ALL_TOKEN[COUNTER];
|
}else if(last_type == TYPE_TIMECODE)
|
|
{
|
if(TXDATA_FLAGCTRL_TX_AUX[8])
|
if(DOUT == !(FCT[2]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]))
|
|
{
|
{
|
SOUT=!SOUT;
|
if(COUNTER == 3)
|
}else
|
|
{
|
{
|
SOUT=SOUT;
|
COUNTER = 0;
|
|
READY_TX = true;
|
|
TXDATA_FLAGCTRL_TX_LAST = TXDATA_FLAGCTRL_TX_AUX;
|
|
last_type = TYPE_EOP_EEP;
|
}
|
}
|
DOUT = !(FCT[2]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]);
|
else
|
|
{
|
|
COUNTER++;
|
}
|
}
|
}
|
}
|
else if(COUNTER == 1)
|
else
|
{
|
{
|
if(DOUT == FCT[2])
|
if(COUNTER == 9)
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = FCT[2];
|
|
}
|
|
else if(COUNTER == 2)
|
|
{
|
|
if(DOUT == FCT[1])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = FCT[1];
|
|
}
|
|
else if(COUNTER == 3)
|
|
{
|
|
if(DOUT == FCT[0])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = FCT[0];
|
|
}
|
|
|
|
COUNTER++;
|
|
|
|
if(COUNTER == 4)
|
|
{
|
|
COUNTER = 0;
|
|
FCT_SEND = FCT_SEND - 1;
|
|
enable_fct = false;
|
|
last_type = TYPE_FCT;
|
|
}
|
|
|
|
}else if(enable_time_code)//
|
|
{
|
|
|
|
TIME_CODE(7,0) = TIMEIN_CONTROL_FLAG_TX;
|
|
|
|
if(COUNTER == 0)
|
|
{
|
|
if(last_type == TYPE_NULL)
|
|
{
|
|
if(DOUT == !(TIME_CODE[12]^NULL_S[0]^NULL_S[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TIME_CODE[12]^NULL_S[0]^NULL_S[1]);
|
|
}else if(last_type == TYPE_FCT)
|
|
{
|
|
if(DOUT == !(TIME_CODE[12]^FCT[0]^FCT[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TIME_CODE[12]^FCT[0]^FCT[1]);
|
|
}else if(last_type == TYPE_NCHAR_EOP_EEP)
|
|
{
|
|
if(TXDATA_FLAGCTRL_TX_LAST[8] == 1)
|
|
{
|
|
EEP_EOP = true;
|
|
if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 0)
|
|
{
|
|
if(DOUT == !(TIME_CODE[12]^EOP[0]^EOP[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TIME_CODE[12]^EOP[0]^EOP[1]);
|
|
}else if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 1)
|
|
{
|
|
if(DOUT == !(TIME_CODE[12]^EEP[0]^EEP[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TIME_CODE[12]^EEP[0]^EEP[1]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(DOUT == !(TIME_CODE[12]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TIME_CODE[12]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]);
|
|
}
|
|
}else if(last_type == TYPE_TIMECODE)
|
|
{
|
|
if( DOUT == !(TIME_CODE[12]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TIME_CODE[12]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]);
|
|
}
|
|
}else if(COUNTER == 1)
|
|
{
|
|
if(DOUT == TIME_CODE[12])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[12];
|
|
}
|
|
else if(COUNTER == 2)
|
|
{
|
|
if(DOUT == TIME_CODE[11])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[11];
|
|
}
|
|
else if(COUNTER == 3)
|
|
{
|
|
if(DOUT == TIME_CODE[10])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[10];
|
|
}
|
|
else if(COUNTER == 4)
|
|
{
|
|
if(DOUT == TIME_CODE[9])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[9];
|
|
}
|
|
else if(COUNTER == 5)
|
|
{
|
|
if(DOUT == TIME_CODE[8])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[8];
|
|
}
|
|
else if(COUNTER == 6)
|
|
{
|
|
if(DOUT == TIME_CODE[0])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[0];
|
|
}
|
|
else if(COUNTER == 7)
|
|
{
|
|
if(DOUT == TIME_CODE[1])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[1];
|
|
}
|
|
else if(COUNTER == 8)
|
|
{
|
|
if(DOUT == TIME_CODE[2])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[2];
|
|
}
|
|
else if(COUNTER == 9)
|
|
{
|
|
if(DOUT == TIME_CODE[3])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[3];
|
|
}
|
|
else if(COUNTER == 10)
|
|
{
|
|
if(DOUT == TIME_CODE[4])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[4];
|
|
}
|
|
else if(COUNTER == 11)
|
|
{
|
|
if(DOUT == TIME_CODE[5])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[5];
|
|
}
|
|
else if(COUNTER == 12)
|
|
{
|
|
if(DOUT == TIME_CODE[6])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[6];
|
|
}
|
|
else if(COUNTER == 13)
|
|
{
|
|
if(DOUT == TIME_CODE[7])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TIME_CODE[7];
|
|
}
|
|
|
|
|
|
COUNTER++;
|
|
|
|
if(COUNTER == 14)
|
|
{
|
|
COUNTER = 0;
|
|
READY_TICK = true;
|
|
enable_time_code = false;
|
|
last_type = TYPE_TIMECODE;
|
|
LAST_TIMEIN_CONTROL_FLAG_TX = TIMEIN_CONTROL_FLAG_TX;
|
|
}
|
|
|
|
}else if(enable_n_char)//
|
|
{
|
|
|
|
TXDATA_FLAGCTRL_TX_AUX = TXDATA_FLAGCTRL_TX;
|
|
|
|
if(TXDATA_FLAGCTRL_TX_AUX[8])//EOP-EEP
|
|
{
|
|
|
|
if(TXDATA_FLAGCTRL_TX_AUX(1,0) == 0) //EOP
|
|
{
|
|
if(COUNTER == 0)
|
|
{
|
|
if(last_type == TYPE_NULL)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^NULL_S[0]^NULL_S[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^NULL_S[0]^NULL_S[1]);
|
|
}else if(last_type == TYPE_FCT)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^FCT[0]^FCT[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^FCT[0]^FCT[1]);
|
|
}else if(last_type == TYPE_NCHAR_EOP_EEP)
|
|
{
|
|
if(TXDATA_FLAGCTRL_TX_LAST[8] == 1)
|
|
{
|
|
EEP_EOP = true;
|
|
if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 0)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^EOP[0]^EOP[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^EOP[0]^EOP[1]);
|
|
}else if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 1)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^EEP[0]^EEP[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^EEP[0]^EEP[1]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]);
|
|
}
|
|
}else if(last_type == TYPE_TIMECODE)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]);
|
|
}
|
|
}
|
|
else if(COUNTER == 1)
|
|
{
|
|
if(DOUT == EOP[2])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = EOP[2];
|
|
}
|
|
else if(COUNTER == 2)
|
|
{
|
|
if(DOUT == EOP[1])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = EOP[1];
|
|
}
|
|
else if(COUNTER == 3)
|
|
{
|
|
if(DOUT == EOP[0])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = EOP[0];
|
|
}
|
|
|
|
COUNTER++;
|
|
|
|
if(COUNTER == 4)
|
|
{
|
{
|
COUNTER = 0;
|
COUNTER = 0;
|
READY_TX = true;
|
READY_TX = true;
|
TXDATA_FLAGCTRL_TX_LAST = TXDATA_FLAGCTRL_TX_AUX;
|
TXDATA_FLAGCTRL_TX_LAST = TXDATA_FLAGCTRL_TX_AUX;
|
FCT_COUNTER = FCT_COUNTER - 1;
|
last_type = TYPE_NCHAR;
|
enable_n_char = false;
|
|
last_type = TYPE_NCHAR_EOP_EEP;
|
|
}
|
|
}
|
|
else if(TXDATA_FLAGCTRL_TX_AUX(1,0) == 1)//EEP
|
|
{
|
|
if(COUNTER == 0)
|
|
{
|
|
if(last_type == TYPE_NULL)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^NULL_S[0]^NULL_S[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^NULL_S[0]^NULL_S[1]);
|
|
}else if(last_type == TYPE_FCT)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^FCT[0]^FCT[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^FCT[0]^FCT[1]);
|
|
}else if(last_type == TYPE_NCHAR_EOP_EEP)
|
|
{
|
|
if(TXDATA_FLAGCTRL_TX_LAST[8] == 1)
|
|
{
|
|
EEP_EOP = true;
|
|
if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 0)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^EOP[0]^EOP[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^EOP[0]^EOP[1]);
|
|
}else if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 1)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^EEP[0]^EEP[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^EEP[0]^EEP[1]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]);
|
|
}
|
|
}else if(last_type == TYPE_TIMECODE)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]);
|
|
}
|
|
}
|
|
else if(COUNTER == 1)
|
|
{
|
|
if(DOUT == EEP[2])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = EEP[2];
|
|
}
|
|
else if(COUNTER == 2)
|
|
{
|
|
if(DOUT == EEP[1])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = EEP[1];
|
|
}
|
|
else if(COUNTER == 3)
|
|
{
|
|
if(DOUT == EOP[0])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
}
|
else
|
else
|
{
|
{
|
SOUT=SOUT;
|
|
}
|
|
DOUT = EOP[0];
|
|
}
|
|
|
|
COUNTER++;
|
COUNTER++;
|
|
|
if(COUNTER == 4)
|
|
{
|
|
COUNTER = 0;
|
|
READY_TX = true;
|
|
TXDATA_FLAGCTRL_TX_LAST = TXDATA_FLAGCTRL_TX_AUX;
|
|
FCT_COUNTER = FCT_COUNTER - 1;
|
|
enable_n_char = false;
|
|
last_type = TYPE_NCHAR_EOP_EEP;
|
|
}
|
|
}
|
|
|
|
}
|
|
else //DATA
|
|
{
|
|
if(COUNTER == 0)
|
|
{
|
|
if(last_type == TYPE_NULL)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^NULL_S[0]^NULL_S[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^NULL_S[0]^NULL_S[1]);
|
|
}else if(last_type == TYPE_FCT)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^FCT[0]^FCT[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^FCT[0]^FCT[1]);
|
|
}else if(last_type == TYPE_NCHAR_EOP_EEP)
|
|
{
|
|
if(TXDATA_FLAGCTRL_TX_LAST[8] == 1)
|
|
{
|
|
EEP_EOP = true;
|
|
if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 0)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^EOP[0]^EOP[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^EOP[0]^EOP[1]);
|
|
}else if(TXDATA_FLAGCTRL_TX_LAST(1,0) == 1)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^EEP[0]^EEP[1]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^EEP[0]^EEP[1]);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^TXDATA_FLAGCTRL_TX_LAST[0]^TXDATA_FLAGCTRL_TX_LAST[1]^TXDATA_FLAGCTRL_TX_LAST[2]^TXDATA_FLAGCTRL_TX_LAST[3]^ TXDATA_FLAGCTRL_TX_LAST[4]^TXDATA_FLAGCTRL_TX_LAST[5]^TXDATA_FLAGCTRL_TX_LAST[6]^TXDATA_FLAGCTRL_TX_LAST[7]);
|
|
}
|
|
}else if(last_type == TYPE_TIMECODE)
|
|
{
|
|
if(DOUT == !(TXDATA_FLAGCTRL_TX_AUX[8]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]))
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = !(TXDATA_FLAGCTRL_TX_AUX[8]^LAST_TIMEIN_CONTROL_FLAG_TX[7]^LAST_TIMEIN_CONTROL_FLAG_TX[6]^LAST_TIMEIN_CONTROL_FLAG_TX[5]^LAST_TIMEIN_CONTROL_FLAG_TX[4]^LAST_TIMEIN_CONTROL_FLAG_TX[3]^LAST_TIMEIN_CONTROL_FLAG_TX[2]^LAST_TIMEIN_CONTROL_FLAG_TX[1]^LAST_TIMEIN_CONTROL_FLAG_TX[0]);
|
|
}
|
|
}
|
|
else if(COUNTER == 1)
|
|
{
|
|
if(DOUT == TXDATA_FLAGCTRL_TX_AUX[8])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TXDATA_FLAGCTRL_TX_AUX[8];
|
|
}
|
|
else if(COUNTER == 2)
|
|
{
|
|
if(DOUT == TXDATA_FLAGCTRL_TX_AUX[0])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TXDATA_FLAGCTRL_TX_AUX[0];
|
|
}
|
|
else if(COUNTER == 3)
|
|
{
|
|
if(DOUT == TXDATA_FLAGCTRL_TX_AUX[1])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TXDATA_FLAGCTRL_TX_AUX[1];
|
|
}
|
|
else if(COUNTER == 4)
|
|
{
|
|
if(DOUT == TXDATA_FLAGCTRL_TX_AUX[2])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TXDATA_FLAGCTRL_TX_AUX[2];
|
|
}
|
|
else if(COUNTER == 5)
|
|
{
|
|
if(DOUT == TXDATA_FLAGCTRL_TX_AUX[3])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TXDATA_FLAGCTRL_TX_AUX[3];
|
|
}
|
|
else if(COUNTER == 6)
|
|
{
|
|
if(DOUT == TXDATA_FLAGCTRL_TX_AUX[4])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
|
DOUT = TXDATA_FLAGCTRL_TX_AUX[4];
|
|
}
|
|
else if(COUNTER == 7)
|
|
{
|
|
if(DOUT == TXDATA_FLAGCTRL_TX_AUX[5])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
}
|
DOUT = TXDATA_FLAGCTRL_TX_AUX[5];
|
|
}
|
|
else if(COUNTER == 8)
|
|
{
|
|
if(DOUT == TXDATA_FLAGCTRL_TX_AUX[6])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
}
|
else
|
|
{
|
|
SOUT=SOUT;
|
|
}
|
}
|
DOUT = TXDATA_FLAGCTRL_TX_AUX[6];
|
|
}
|
}
|
else if(COUNTER == 9)
|
|
{
|
|
if(DOUT == TXDATA_FLAGCTRL_TX_AUX[7])
|
|
{
|
|
SOUT=!SOUT;
|
|
}
|
}
|
else
|
else
|
{
|
{
|
SOUT=SOUT;
|
DOUT = 0;
|
}
|
SOUT = 0;
|
DOUT = TXDATA_FLAGCTRL_TX_AUX[7];
|
|
}
|
|
|
|
COUNTER++;
|
|
|
|
if(COUNTER == 10)
|
|
{
|
|
COUNTER = 0;
|
|
READY_TX = true;
|
|
TXDATA_FLAGCTRL_TX_LAST = TXDATA_FLAGCTRL_TX_AUX;
|
|
FCT_COUNTER = FCT_COUNTER - 1;
|
|
enable_n_char = false;
|
|
last_type = TYPE_NCHAR_EOP_EEP;
|
|
}
|
|
}
|
|
|
|
}
|
}
|
|
|
}
|
}
|
}//END METHOD
|
}//END METHOD
|
|
|
|
|
SC_CTOR(SPW_TX_SC)
|
SC_CTOR(SPW_TX_SC)
|
{
|
{
|
SC_METHOD(FCT_COUNTER_SEND);
|
SC_METHOD(FCT_COUNTER_SEND);
|
sensitive << CLOCK_SYS.pos();
|
sensitive << CLOCK_SYS.pos();
|
|
|
SC_METHOD(FCT_COUNTER_M);
|
SC_METHOD(FCT_COUNTER_M);
|
sensitive << CLOCK_SYS.pos();
|
sensitive << CLOCK_SYS.pos();
|
|
|
SC_METHOD(ALL_HERE);
|
//SC_METHOD(ALL_HERE);
|
|
//sensitive << CLOCK_TX.pos();
|
|
|
|
SC_METHOD(PROCESS_DATA);
|
sensitive << CLOCK_TX.pos();
|
sensitive << CLOCK_TX.pos();
|
|
|
SC_METHOD(TYPE_DATA_STATE);
|
SC_METHOD(TYPE_DATA_STATE);
|
sensitive << CLOCK_TX.pos();
|
sensitive << CLOCK_TX.pos();
|
}
|
}
|