| 1 |
5 |
redbear |
//+FHDR------------------------------------------------------------------------
|
| 2 |
|
|
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
|
| 3 |
|
|
//GLADIC Open Source RTL
|
| 4 |
|
|
//-----------------------------------------------------------------------------
|
| 5 |
|
|
//FILE NAME :
|
| 6 |
|
|
//DEPARTMENT : IC Design / Verification
|
| 7 |
|
|
//AUTHOR : Felipe Fernandes da Costa
|
| 8 |
|
|
//AUTHOR’S EMAIL :
|
| 9 |
|
|
//-----------------------------------------------------------------------------
|
| 10 |
|
|
//RELEASE HISTORY
|
| 11 |
|
|
//VERSION DATE AUTHOR DESCRIPTION
|
| 12 |
|
|
//1.0 YYYY-MM-DD name
|
| 13 |
|
|
//-----------------------------------------------------------------------------
|
| 14 |
|
|
//KEYWORDS : General file searching keywords, leave blank if none.
|
| 15 |
|
|
//-----------------------------------------------------------------------------
|
| 16 |
|
|
//PURPOSE : ECSS_E_ST_50_12C_31_july_2008
|
| 17 |
|
|
//-----------------------------------------------------------------------------
|
| 18 |
|
|
//PARAMETERS
|
| 19 |
|
|
//PARAM NAME RANGE : DESCRIPTION : DEFAULT : UNITS
|
| 20 |
|
|
//e.g.DATA_WIDTH [32,16] : width of the DATA : 32:
|
| 21 |
|
|
//-----------------------------------------------------------------------------
|
| 22 |
|
|
//REUSE ISSUES
|
| 23 |
|
|
//Reset Strategy :
|
| 24 |
|
|
//Clock Domains :
|
| 25 |
|
|
//Critical Timing :
|
| 26 |
|
|
//Test Features :
|
| 27 |
|
|
//Asynchronous I/F :
|
| 28 |
|
|
//Scan Methodology :
|
| 29 |
|
|
//Instantiations :
|
| 30 |
|
|
//Synthesizable (y/n) :
|
| 31 |
|
|
//Other :
|
| 32 |
|
|
//-FHDR------------------------------------------------------------------------
|
| 33 |
|
|
|
| 34 |
|
|
`timescale 1ns/1ns
|
| 35 |
|
|
|
| 36 |
|
|
module TX_SPW (
|
| 37 |
|
|
input pclk_tx,
|
| 38 |
|
|
//
|
| 39 |
|
|
input [8:0] data_tx_i,
|
| 40 |
|
|
input txwrite_tx,
|
| 41 |
|
|
//
|
| 42 |
|
|
input [7:0] timecode_tx_i,
|
| 43 |
|
|
input tickin_tx,
|
| 44 |
|
|
//
|
| 45 |
|
|
input enable_tx,
|
| 46 |
|
|
input send_null_tx,
|
| 47 |
|
|
input send_fct_tx,
|
| 48 |
|
|
|
| 49 |
|
|
//
|
| 50 |
|
|
input gotfct_tx,
|
| 51 |
|
|
input send_fct_now,
|
| 52 |
|
|
//
|
| 53 |
|
|
output reg tx_dout,
|
| 54 |
|
|
output reg tx_sout,
|
| 55 |
|
|
//
|
| 56 |
8 |
redbear |
output reg ready_tx_data,
|
| 57 |
13 |
redbear |
output reg ready_tx_timecode
|
| 58 |
5 |
redbear |
|
| 59 |
|
|
);
|
| 60 |
|
|
|
| 61 |
|
|
localparam [2:0] tx_spw_start = 3'b000,
|
| 62 |
|
|
tx_spw_null = 3'b001,
|
| 63 |
|
|
tx_spw_null_fct = 3'b010,
|
| 64 |
|
|
tx_spw_full = 3'b100;
|
| 65 |
|
|
|
| 66 |
|
|
localparam [5:0] NULL = 6'b000001,
|
| 67 |
|
|
FCT = 6'b000010,
|
| 68 |
|
|
EOP = 6'b000100,
|
| 69 |
|
|
EEP = 6'b001000,
|
| 70 |
|
|
DATA = 6'b010000,
|
| 71 |
|
|
TIMEC = 6'b100000;
|
| 72 |
|
|
|
| 73 |
|
|
reg [2:0] state_tx;
|
| 74 |
|
|
reg [2:0] next_state_tx;
|
| 75 |
|
|
|
| 76 |
|
|
reg [7:0] null_s;
|
| 77 |
|
|
reg [3:0] fct_s;
|
| 78 |
|
|
reg [3:0] eop_s;
|
| 79 |
|
|
reg [3:0] eep_s;
|
| 80 |
|
|
reg [13:0] timecode_s;
|
| 81 |
|
|
|
| 82 |
|
|
reg [5:0] last_type;
|
| 83 |
|
|
reg [8:0] txdata_flagctrl_tx_last;
|
| 84 |
|
|
reg [7:0] last_timein_control_flag_tx;
|
| 85 |
|
|
|
| 86 |
|
|
reg first_time;
|
| 87 |
|
|
|
| 88 |
8 |
redbear |
reg hold_null;
|
| 89 |
|
|
reg hold_fct;
|
| 90 |
|
|
reg hold_data;
|
| 91 |
|
|
reg hold_time_code;
|
| 92 |
|
|
|
| 93 |
5 |
redbear |
reg enable_null;
|
| 94 |
|
|
reg enable_fct;
|
| 95 |
|
|
reg enable_n_char;
|
| 96 |
|
|
reg enable_time_code;
|
| 97 |
|
|
|
| 98 |
|
|
reg [2:0] fct_send;
|
| 99 |
|
|
reg [2:0] fct_flag;
|
| 100 |
6 |
redbear |
|
| 101 |
5 |
redbear |
reg [5:0] fct_counter;
|
| 102 |
6 |
redbear |
reg [5:0] fct_counter_receive;
|
| 103 |
|
|
|
| 104 |
5 |
redbear |
reg last_tx_dout;
|
| 105 |
|
|
reg last_tx_sout;
|
| 106 |
|
|
|
| 107 |
17 |
redbear |
reg block_sum;
|
| 108 |
19 |
redbear |
reg block_sum_fct_send;
|
| 109 |
17 |
redbear |
|
| 110 |
5 |
redbear |
reg [3:0] global_counter_transfer;
|
| 111 |
|
|
|
| 112 |
|
|
|
| 113 |
13 |
redbear |
|
| 114 |
5 |
redbear |
always@(*)
|
| 115 |
|
|
begin
|
| 116 |
|
|
tx_dout = 1'b0;
|
| 117 |
|
|
|
| 118 |
|
|
if(!enable_tx)
|
| 119 |
|
|
begin
|
| 120 |
|
|
tx_dout = 1'b0;
|
| 121 |
|
|
end
|
| 122 |
|
|
else if( enable_null & first_time & global_counter_transfer == 4'd0)
|
| 123 |
|
|
begin
|
| 124 |
|
|
tx_dout = null_s[7];
|
| 125 |
|
|
end
|
| 126 |
|
|
else if( enable_null & !first_time & last_type == NULL & global_counter_transfer == 4'd0)
|
| 127 |
|
|
begin
|
| 128 |
|
|
tx_dout = !(null_s[6]^null_s[0]^null_s[1]);
|
| 129 |
|
|
end
|
| 130 |
|
|
else if( enable_null & !first_time & last_type == FCT & global_counter_transfer == 4'd0)
|
| 131 |
|
|
begin
|
| 132 |
|
|
tx_dout = !(null_s[6]^fct_s[0]^fct_s[1]);
|
| 133 |
|
|
end
|
| 134 |
|
|
else if( enable_null & !first_time & last_type == EOP & global_counter_transfer == 4'd0)
|
| 135 |
|
|
begin
|
| 136 |
|
|
tx_dout = !(null_s[6]^eop_s[0]^eop_s[1]);
|
| 137 |
|
|
end
|
| 138 |
|
|
else if( enable_null & !first_time & last_type == EEP & global_counter_transfer == 4'd0)
|
| 139 |
|
|
begin
|
| 140 |
|
|
tx_dout = !(null_s[6]^eep_s[0]^eep_s[1]);
|
| 141 |
|
|
end
|
| 142 |
|
|
else if( enable_null & !first_time & last_type == DATA & global_counter_transfer == 4'd0)
|
| 143 |
|
|
begin
|
| 144 |
|
|
tx_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]);
|
| 145 |
|
|
end
|
| 146 |
|
|
else if( enable_null & !first_time & last_type == TIMEC & global_counter_transfer == 4'd0)
|
| 147 |
|
|
begin
|
| 148 |
|
|
tx_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]);
|
| 149 |
|
|
end
|
| 150 |
|
|
else if( enable_null & !first_time & global_counter_transfer == 4'd1)
|
| 151 |
|
|
begin
|
| 152 |
|
|
tx_dout = null_s[6];
|
| 153 |
|
|
end
|
| 154 |
|
|
else if( enable_null & !first_time & global_counter_transfer == 4'd2)
|
| 155 |
|
|
begin
|
| 156 |
|
|
tx_dout = null_s[5];
|
| 157 |
|
|
end
|
| 158 |
|
|
else if( enable_null & !first_time & global_counter_transfer == 4'd3)
|
| 159 |
|
|
begin
|
| 160 |
|
|
tx_dout = null_s[4];
|
| 161 |
|
|
end
|
| 162 |
|
|
else if( enable_null & !first_time & global_counter_transfer == 4'd4)
|
| 163 |
|
|
begin
|
| 164 |
|
|
tx_dout = null_s[3];
|
| 165 |
|
|
end
|
| 166 |
|
|
else if( enable_null & !first_time & global_counter_transfer == 4'd5)
|
| 167 |
|
|
begin
|
| 168 |
|
|
tx_dout = null_s[2];
|
| 169 |
|
|
end
|
| 170 |
|
|
else if( enable_null & !first_time & global_counter_transfer == 4'd6)
|
| 171 |
|
|
begin
|
| 172 |
|
|
tx_dout = null_s[1];
|
| 173 |
|
|
end
|
| 174 |
|
|
else if( enable_null & !first_time & global_counter_transfer == 4'd7)
|
| 175 |
|
|
begin
|
| 176 |
|
|
tx_dout = null_s[0];
|
| 177 |
|
|
end
|
| 178 |
|
|
else if( enable_fct & !first_time & last_type == NULL & global_counter_transfer == 4'd0)
|
| 179 |
|
|
begin
|
| 180 |
|
|
tx_dout = !(fct_s[2]^null_s[0]^null_s[1]);
|
| 181 |
|
|
end
|
| 182 |
|
|
else if( enable_fct & !first_time & last_type == FCT & global_counter_transfer == 4'd0)
|
| 183 |
|
|
begin
|
| 184 |
|
|
tx_dout = !(fct_s[2]^fct_s[0]^fct_s[1]);
|
| 185 |
|
|
end
|
| 186 |
|
|
else if( enable_fct & !first_time & last_type == EOP & global_counter_transfer == 4'd0)
|
| 187 |
|
|
begin
|
| 188 |
|
|
tx_dout = !(fct_s[2]^eop_s[0]^eop_s[1]);
|
| 189 |
|
|
end
|
| 190 |
|
|
else if( enable_fct & !first_time & last_type == EEP & global_counter_transfer == 4'd0)
|
| 191 |
|
|
begin
|
| 192 |
|
|
tx_dout = !(fct_s[2]^eep_s[0]^eep_s[1]);
|
| 193 |
|
|
end
|
| 194 |
|
|
else if ( enable_fct & !first_time & last_type == DATA & global_counter_transfer == 4'd0)
|
| 195 |
|
|
begin
|
| 196 |
|
|
tx_dout = !(fct_s[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]);
|
| 197 |
|
|
end
|
| 198 |
|
|
else if( enable_fct & !first_time & last_type == TIMEC & global_counter_transfer == 4'd0)
|
| 199 |
|
|
begin
|
| 200 |
|
|
tx_dout = !(fct_s[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]);
|
| 201 |
|
|
end
|
| 202 |
|
|
else if( enable_fct & !first_time & global_counter_transfer == 4'd1)
|
| 203 |
|
|
begin
|
| 204 |
|
|
tx_dout = fct_s[2];
|
| 205 |
|
|
end
|
| 206 |
|
|
else if( enable_fct & !first_time & global_counter_transfer == 4'd2)
|
| 207 |
|
|
begin
|
| 208 |
|
|
tx_dout = fct_s[1];
|
| 209 |
|
|
end
|
| 210 |
|
|
else if( enable_fct & !first_time & global_counter_transfer == 4'd3)
|
| 211 |
|
|
begin
|
| 212 |
|
|
tx_dout = fct_s[0];
|
| 213 |
|
|
end
|
| 214 |
|
|
else if( enable_time_code & !first_time & last_type == NULL & global_counter_transfer == 4'd0)
|
| 215 |
|
|
begin
|
| 216 |
|
|
tx_dout = !(timecode_s[12]^null_s[0]^null_s[1]);
|
| 217 |
|
|
end
|
| 218 |
|
|
else if( enable_time_code & !first_time & last_type == FCT & global_counter_transfer == 4'd0)
|
| 219 |
|
|
begin
|
| 220 |
|
|
tx_dout = !(timecode_s[12]^fct_s[0]^fct_s[1]);
|
| 221 |
|
|
end
|
| 222 |
|
|
else if ( enable_time_code & !first_time & last_type == EOP & global_counter_transfer == 4'd0)
|
| 223 |
|
|
begin
|
| 224 |
|
|
tx_dout = !(timecode_s[12]^eop_s[0]^eop_s[1]);
|
| 225 |
|
|
end
|
| 226 |
|
|
else if( enable_time_code & !first_time & last_type == EEP & global_counter_transfer == 4'd0)
|
| 227 |
|
|
begin
|
| 228 |
|
|
tx_dout = !(timecode_s[12]^eep_s[0]^eep_s[1]);
|
| 229 |
|
|
end
|
| 230 |
|
|
else if( enable_time_code & !first_time & last_type == DATA & global_counter_transfer == 4'd0)
|
| 231 |
|
|
begin
|
| 232 |
|
|
tx_dout = !(timecode_s[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]);
|
| 233 |
|
|
end
|
| 234 |
|
|
else if( enable_time_code & !first_time & last_type == TIMEC & global_counter_transfer == 4'd0)
|
| 235 |
|
|
begin
|
| 236 |
|
|
tx_dout = !(timecode_s[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]);
|
| 237 |
|
|
end
|
| 238 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd1)
|
| 239 |
|
|
begin
|
| 240 |
|
|
tx_dout = timecode_s[12];
|
| 241 |
|
|
end
|
| 242 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd2)
|
| 243 |
|
|
begin
|
| 244 |
|
|
tx_dout = timecode_s[11];
|
| 245 |
|
|
end
|
| 246 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd3)
|
| 247 |
|
|
begin
|
| 248 |
|
|
tx_dout = timecode_s[10];
|
| 249 |
|
|
end
|
| 250 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd4)
|
| 251 |
|
|
begin
|
| 252 |
|
|
tx_dout = timecode_s[9];
|
| 253 |
|
|
end
|
| 254 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd5)
|
| 255 |
|
|
begin
|
| 256 |
|
|
tx_dout = timecode_s[8];
|
| 257 |
|
|
end
|
| 258 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd6)
|
| 259 |
|
|
begin
|
| 260 |
13 |
redbear |
tx_dout = timecode_s[0];
|
| 261 |
5 |
redbear |
end
|
| 262 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd7)
|
| 263 |
|
|
begin
|
| 264 |
13 |
redbear |
tx_dout = timecode_s[1];
|
| 265 |
5 |
redbear |
end
|
| 266 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd8)
|
| 267 |
|
|
begin
|
| 268 |
13 |
redbear |
tx_dout = timecode_s[2];
|
| 269 |
5 |
redbear |
end
|
| 270 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd9)
|
| 271 |
|
|
begin
|
| 272 |
13 |
redbear |
tx_dout = timecode_s[3];
|
| 273 |
5 |
redbear |
end
|
| 274 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd10)
|
| 275 |
|
|
begin
|
| 276 |
13 |
redbear |
tx_dout = timecode_s[4];
|
| 277 |
5 |
redbear |
end
|
| 278 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd11)
|
| 279 |
|
|
begin
|
| 280 |
13 |
redbear |
tx_dout = timecode_s[5];
|
| 281 |
5 |
redbear |
end
|
| 282 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd12)
|
| 283 |
|
|
begin
|
| 284 |
13 |
redbear |
tx_dout = timecode_s[6];
|
| 285 |
5 |
redbear |
end
|
| 286 |
|
|
else if( enable_time_code & !first_time & global_counter_transfer == 4'd13)
|
| 287 |
|
|
begin
|
| 288 |
13 |
redbear |
tx_dout = timecode_s[7];
|
| 289 |
5 |
redbear |
end
|
| 290 |
8 |
redbear |
else if( enable_n_char & !data_tx_i[8] & !first_time & last_type == NULL & global_counter_transfer == 4'd0)
|
| 291 |
5 |
redbear |
begin
|
| 292 |
|
|
tx_dout = !(data_tx_i[8]^null_s[0]^null_s[1]);
|
| 293 |
|
|
end
|
| 294 |
8 |
redbear |
else if( enable_n_char & !data_tx_i[8] & !first_time & last_type == FCT & global_counter_transfer == 4'd0)
|
| 295 |
5 |
redbear |
begin
|
| 296 |
|
|
tx_dout = !(data_tx_i[8]^fct_s[0]^fct_s[1]);
|
| 297 |
|
|
end
|
| 298 |
8 |
redbear |
else if( enable_n_char & !data_tx_i[8] & !first_time & last_type == EOP & global_counter_transfer == 4'd0)
|
| 299 |
5 |
redbear |
begin
|
| 300 |
|
|
tx_dout = !(data_tx_i[8]^eop_s[0]^eop_s[1]);
|
| 301 |
|
|
end
|
| 302 |
8 |
redbear |
else if( enable_n_char & !data_tx_i[8] & !first_time & last_type == EEP & global_counter_transfer == 4'd0)
|
| 303 |
5 |
redbear |
begin
|
| 304 |
|
|
tx_dout = !(data_tx_i[8]^eep_s[0]^eep_s[1]);
|
| 305 |
|
|
end
|
| 306 |
8 |
redbear |
else if( enable_n_char & !data_tx_i[8] & !first_time & last_type == DATA & global_counter_transfer == 4'd0)
|
| 307 |
5 |
redbear |
begin
|
| 308 |
|
|
tx_dout = !(data_tx_i[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]);
|
| 309 |
|
|
end
|
| 310 |
8 |
redbear |
else if( enable_n_char & !data_tx_i[8] & !first_time & last_type == TIMEC & global_counter_transfer == 4'd0)
|
| 311 |
5 |
redbear |
begin
|
| 312 |
|
|
tx_dout = !(data_tx_i[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]);
|
| 313 |
|
|
end
|
| 314 |
8 |
redbear |
else if( enable_n_char & data_tx_i[8] & data_tx_i[1:0] == 2'b00 & !first_time & last_type == NULL & global_counter_transfer == 4'd0)
|
| 315 |
5 |
redbear |
begin
|
| 316 |
8 |
redbear |
tx_dout = !(eop_s[3]^null_s[0]^null_s[1]);
|
| 317 |
|
|
end
|
| 318 |
|
|
else if( enable_n_char & !data_tx_i[8] & data_tx_i[1:0] == 2'b00 & !first_time & last_type == FCT & global_counter_transfer == 4'd0)
|
| 319 |
|
|
begin
|
| 320 |
|
|
tx_dout = !(eop_s[3]^fct_s[0]^fct_s[1]);
|
| 321 |
|
|
end
|
| 322 |
|
|
else if( enable_n_char & !data_tx_i[8] & data_tx_i[1:0] == 2'b00 & !first_time & last_type == EOP & global_counter_transfer == 4'd0)
|
| 323 |
|
|
begin
|
| 324 |
|
|
tx_dout = !(eop_s[3]^eop_s[0]^eop_s[1]);
|
| 325 |
|
|
end
|
| 326 |
|
|
else if( enable_n_char & !data_tx_i[8] & data_tx_i[1:0] == 2'b00 & !first_time & last_type == EEP & global_counter_transfer == 4'd0)
|
| 327 |
|
|
begin
|
| 328 |
|
|
tx_dout = !(eop_s[3]^eep_s[0]^eep_s[1]);
|
| 329 |
|
|
end
|
| 330 |
|
|
else if( enable_n_char & !data_tx_i[8] & data_tx_i[1:0] == 2'b00 & !first_time & last_type == DATA & global_counter_transfer == 4'd0)
|
| 331 |
|
|
begin
|
| 332 |
|
|
tx_dout = !(eop_s[3]^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]);
|
| 333 |
|
|
end
|
| 334 |
|
|
else if( enable_n_char & !data_tx_i[8] & data_tx_i[1:0] == 2'b00 & !first_time & last_type == TIMEC & global_counter_transfer == 4'd0)
|
| 335 |
|
|
begin
|
| 336 |
|
|
tx_dout = !(eop_s[3]^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]);
|
| 337 |
|
|
end
|
| 338 |
|
|
else if( enable_n_char & data_tx_i[8] & data_tx_i[1:0] == 2'b00 & !first_time & global_counter_transfer == 4'd1)
|
| 339 |
|
|
begin
|
| 340 |
|
|
tx_dout = eop_s[2];
|
| 341 |
|
|
end
|
| 342 |
|
|
else if( enable_n_char & data_tx_i[8] & data_tx_i[1:0] == 2'b00 & !first_time & global_counter_transfer == 4'd2)
|
| 343 |
|
|
begin
|
| 344 |
|
|
tx_dout = eop_s[1];
|
| 345 |
|
|
end
|
| 346 |
|
|
else if( enable_n_char & data_tx_i[8] & data_tx_i[1:0] == 2'b00 & !first_time & global_counter_transfer == 4'd3)
|
| 347 |
|
|
begin
|
| 348 |
|
|
tx_dout = eop_s[0];
|
| 349 |
|
|
end
|
| 350 |
|
|
else if( enable_n_char & data_tx_i[8] & data_tx_i[1:0] == 2'b01 & !first_time & last_type == NULL & global_counter_transfer == 4'd0)
|
| 351 |
|
|
begin
|
| 352 |
|
|
tx_dout = !(eep_s[3]^null_s[0]^null_s[1]);
|
| 353 |
|
|
end
|
| 354 |
|
|
else if( enable_n_char & !data_tx_i[8] & data_tx_i[1:0] == 2'b01 & !first_time & last_type == FCT & global_counter_transfer == 4'd0)
|
| 355 |
|
|
begin
|
| 356 |
|
|
tx_dout = !(eep_s[3]^fct_s[0]^fct_s[1]);
|
| 357 |
|
|
end
|
| 358 |
|
|
else if( enable_n_char & !data_tx_i[8] & data_tx_i[1:0] == 2'b01 & !first_time & last_type == EOP & global_counter_transfer == 4'd0)
|
| 359 |
|
|
begin
|
| 360 |
|
|
tx_dout = !(eep_s[3]^eop_s[0]^eop_s[1]);
|
| 361 |
|
|
end
|
| 362 |
|
|
else if( enable_n_char & !data_tx_i[8] & data_tx_i[1:0] == 2'b01 & !first_time & last_type == EEP & global_counter_transfer == 4'd0)
|
| 363 |
|
|
begin
|
| 364 |
|
|
tx_dout = !(eep_s[3]^eep_s[0]^eep_s[1]);
|
| 365 |
|
|
end
|
| 366 |
|
|
else if( enable_n_char & !data_tx_i[8] & data_tx_i[1:0] == 2'b01 & !first_time & last_type == DATA & global_counter_transfer == 4'd0)
|
| 367 |
|
|
begin
|
| 368 |
|
|
tx_dout = !(eep_s[3]^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]);
|
| 369 |
|
|
end
|
| 370 |
|
|
else if( enable_n_char & !data_tx_i[8] & data_tx_i[1:0] == 2'b01 & !first_time & last_type == TIMEC & global_counter_transfer == 4'd0)
|
| 371 |
|
|
begin
|
| 372 |
|
|
tx_dout = !(eep_s[3]^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]);
|
| 373 |
|
|
end
|
| 374 |
|
|
else if( enable_n_char & !data_tx_i[8] & !data_tx_i[8] & !first_time & global_counter_transfer == 4'd1)
|
| 375 |
|
|
begin
|
| 376 |
5 |
redbear |
tx_dout = data_tx_i[8];
|
| 377 |
|
|
end
|
| 378 |
|
|
else if( enable_n_char & !data_tx_i[8] & !first_time & global_counter_transfer == 4'd2)
|
| 379 |
|
|
begin
|
| 380 |
|
|
tx_dout = data_tx_i[0];
|
| 381 |
|
|
end
|
| 382 |
|
|
else if( enable_n_char & !data_tx_i[8] & !first_time & global_counter_transfer == 4'd3)
|
| 383 |
|
|
begin
|
| 384 |
|
|
tx_dout = data_tx_i[1];
|
| 385 |
|
|
end
|
| 386 |
|
|
else if( enable_n_char & !data_tx_i[8] & !first_time & global_counter_transfer == 4'd4)
|
| 387 |
|
|
begin
|
| 388 |
|
|
tx_dout = data_tx_i[2];
|
| 389 |
|
|
end
|
| 390 |
|
|
else if( enable_n_char & !data_tx_i[8] & !first_time & global_counter_transfer == 4'd5)
|
| 391 |
|
|
begin
|
| 392 |
|
|
tx_dout = data_tx_i[3];
|
| 393 |
|
|
end
|
| 394 |
|
|
else if( enable_n_char & !data_tx_i[8] & !first_time & global_counter_transfer == 4'd6)
|
| 395 |
|
|
begin
|
| 396 |
|
|
tx_dout = data_tx_i[4];
|
| 397 |
|
|
end
|
| 398 |
|
|
else if( enable_n_char & !data_tx_i[8] & !first_time & global_counter_transfer == 4'd7)
|
| 399 |
|
|
begin
|
| 400 |
|
|
tx_dout = data_tx_i[5];
|
| 401 |
|
|
end
|
| 402 |
|
|
else if( enable_n_char & !data_tx_i[8] & !first_time & global_counter_transfer == 4'd8)
|
| 403 |
|
|
begin
|
| 404 |
|
|
tx_dout = data_tx_i[6];
|
| 405 |
|
|
end
|
| 406 |
|
|
else if( enable_n_char & !data_tx_i[8] & !first_time & global_counter_transfer == 4'd9)
|
| 407 |
|
|
begin
|
| 408 |
|
|
tx_dout = data_tx_i[7];
|
| 409 |
|
|
end
|
| 410 |
|
|
else if( enable_n_char & data_tx_i[8] & data_tx_i[1:0] == 2'b01 & !first_time & global_counter_transfer == 4'd1)
|
| 411 |
|
|
begin
|
| 412 |
|
|
tx_dout = eep_s[2];
|
| 413 |
|
|
end
|
| 414 |
|
|
else if( enable_n_char & data_tx_i[8] & data_tx_i[1:0] == 2'b01 & !first_time & global_counter_transfer == 4'd2)
|
| 415 |
|
|
begin
|
| 416 |
|
|
tx_dout = eep_s[1];
|
| 417 |
|
|
end
|
| 418 |
|
|
else if( enable_n_char & data_tx_i[8] & data_tx_i[1:0] == 2'b01 & !first_time & global_counter_transfer == 4'd3)
|
| 419 |
|
|
begin
|
| 420 |
|
|
tx_dout = eep_s[0];
|
| 421 |
|
|
end
|
| 422 |
|
|
end
|
| 423 |
|
|
|
| 424 |
|
|
//strobe
|
| 425 |
|
|
always@(*)
|
| 426 |
|
|
begin
|
| 427 |
|
|
tx_sout = 1'b0;
|
| 428 |
|
|
|
| 429 |
|
|
if(!enable_tx)
|
| 430 |
|
|
begin
|
| 431 |
|
|
tx_sout = 1'b0;
|
| 432 |
|
|
end
|
| 433 |
13 |
redbear |
else if((enable_null | enable_fct | enable_n_char | enable_time_code) && tx_dout == last_tx_dout)
|
| 434 |
5 |
redbear |
begin
|
| 435 |
|
|
tx_sout = !last_tx_sout;
|
| 436 |
|
|
end
|
| 437 |
13 |
redbear |
else if((enable_null | enable_fct | enable_n_char | enable_time_code) && tx_dout != last_tx_dout)
|
| 438 |
5 |
redbear |
begin
|
| 439 |
|
|
tx_sout = last_tx_sout;
|
| 440 |
12 |
redbear |
end
|
| 441 |
|
|
|
| 442 |
5 |
redbear |
end
|
| 443 |
|
|
|
| 444 |
17 |
redbear |
always@(*)
|
| 445 |
5 |
redbear |
begin
|
| 446 |
17 |
redbear |
fct_counter = 6'd0;
|
| 447 |
|
|
|
| 448 |
|
|
if(gotfct_tx)
|
| 449 |
5 |
redbear |
begin
|
| 450 |
17 |
redbear |
if(block_sum)
|
| 451 |
15 |
redbear |
begin
|
| 452 |
17 |
redbear |
|
| 453 |
|
|
end
|
| 454 |
|
|
else
|
| 455 |
|
|
begin
|
| 456 |
|
|
if(fct_counter_receive < 6'd48)
|
| 457 |
15 |
redbear |
begin
|
| 458 |
17 |
redbear |
fct_counter = fct_counter_receive + 6'd8;
|
| 459 |
15 |
redbear |
end
|
| 460 |
|
|
else
|
| 461 |
|
|
begin
|
| 462 |
17 |
redbear |
fct_counter = fct_counter_receive + 6'd7;
|
| 463 |
|
|
|
| 464 |
15 |
redbear |
end
|
| 465 |
|
|
end
|
| 466 |
5 |
redbear |
end
|
| 467 |
|
|
end
|
| 468 |
|
|
|
| 469 |
|
|
//slots open in our side
|
| 470 |
19 |
redbear |
always@(*)
|
| 471 |
5 |
redbear |
begin
|
| 472 |
|
|
|
| 473 |
19 |
redbear |
fct_send = {3{1'b0}};
|
| 474 |
|
|
|
| 475 |
|
|
if(send_fct_now)
|
| 476 |
5 |
redbear |
begin
|
| 477 |
19 |
redbear |
if(block_sum_fct_send)
|
| 478 |
|
|
begin
|
| 479 |
6 |
redbear |
|
| 480 |
|
|
end
|
| 481 |
|
|
else
|
| 482 |
|
|
begin
|
| 483 |
19 |
redbear |
if(fct_flag == 3'd7)
|
| 484 |
|
|
begin
|
| 485 |
|
|
fct_send = 3'd0;
|
| 486 |
|
|
end
|
| 487 |
|
|
else
|
| 488 |
|
|
begin
|
| 489 |
|
|
fct_send = fct_flag + 3'd1;
|
| 490 |
|
|
|
| 491 |
|
|
end
|
| 492 |
6 |
redbear |
end
|
| 493 |
5 |
redbear |
end
|
| 494 |
|
|
end
|
| 495 |
|
|
|
| 496 |
|
|
|
| 497 |
|
|
always@(*)
|
| 498 |
|
|
begin
|
| 499 |
|
|
|
| 500 |
|
|
|
| 501 |
|
|
enable_null = 1'b0;
|
| 502 |
|
|
enable_fct = 1'b0;
|
| 503 |
|
|
enable_n_char = 1'b0;
|
| 504 |
|
|
enable_time_code = 1'b0;
|
| 505 |
|
|
|
| 506 |
17 |
redbear |
next_state_tx = state_tx;
|
| 507 |
|
|
|
| 508 |
5 |
redbear |
case(state_tx)
|
| 509 |
|
|
tx_spw_start:
|
| 510 |
|
|
begin
|
| 511 |
|
|
if(send_null_tx && enable_tx)
|
| 512 |
|
|
begin
|
| 513 |
12 |
redbear |
//if(!hold_null)
|
| 514 |
5 |
redbear |
next_state_tx = tx_spw_null;
|
| 515 |
|
|
|
| 516 |
12 |
redbear |
//enable_null = 1'b1;
|
| 517 |
5 |
redbear |
end
|
| 518 |
|
|
else
|
| 519 |
|
|
begin
|
| 520 |
|
|
next_state_tx = tx_spw_start;
|
| 521 |
|
|
end
|
| 522 |
|
|
end
|
| 523 |
|
|
tx_spw_null:
|
| 524 |
|
|
begin
|
| 525 |
|
|
enable_null = 1'b1;
|
| 526 |
|
|
|
| 527 |
8 |
redbear |
if(!hold_null)
|
| 528 |
5 |
redbear |
begin
|
| 529 |
|
|
if(send_null_tx && send_fct_tx && enable_tx)
|
| 530 |
|
|
next_state_tx = tx_spw_null_fct;
|
| 531 |
|
|
else
|
| 532 |
|
|
next_state_tx = tx_spw_null;
|
| 533 |
|
|
end
|
| 534 |
|
|
|
| 535 |
|
|
end
|
| 536 |
|
|
tx_spw_null_fct:
|
| 537 |
|
|
begin
|
| 538 |
|
|
|
| 539 |
|
|
enable_null = 1'b1;
|
| 540 |
|
|
|
| 541 |
8 |
redbear |
if(send_fct_tx && fct_flag > 0 && !hold_null)
|
| 542 |
5 |
redbear |
begin
|
| 543 |
8 |
redbear |
next_state_tx = tx_spw_null_fct;
|
| 544 |
5 |
redbear |
enable_null = 1'b0;
|
| 545 |
8 |
redbear |
enable_fct = 1'b1;
|
| 546 |
5 |
redbear |
end
|
| 547 |
|
|
else
|
| 548 |
|
|
begin
|
| 549 |
|
|
enable_fct = 1'b0;
|
| 550 |
17 |
redbear |
if(send_fct_tx && fct_counter_receive > 6'd0)
|
| 551 |
5 |
redbear |
begin
|
| 552 |
12 |
redbear |
//if(global_counter_transfer == 4'd7)
|
| 553 |
|
|
next_state_tx = tx_spw_full;
|
| 554 |
5 |
redbear |
end
|
| 555 |
|
|
|
| 556 |
|
|
end
|
| 557 |
|
|
end
|
| 558 |
|
|
tx_spw_full:
|
| 559 |
|
|
begin
|
| 560 |
8 |
redbear |
if(tickin_tx && !hold_null && !hold_fct && !hold_data)
|
| 561 |
5 |
redbear |
begin
|
| 562 |
6 |
redbear |
enable_time_code = 1'b1;
|
| 563 |
5 |
redbear |
end
|
| 564 |
8 |
redbear |
else if(fct_flag > 3'd0 && !hold_null && !hold_time_code && !hold_data)
|
| 565 |
5 |
redbear |
begin
|
| 566 |
6 |
redbear |
enable_fct = 1'b1;
|
| 567 |
5 |
redbear |
end
|
| 568 |
17 |
redbear |
else if((txwrite_tx && fct_counter_receive > 6'd0 && !hold_null && !hold_time_code && !hold_fct) == 1'b1 )
|
| 569 |
5 |
redbear |
begin
|
| 570 |
8 |
redbear |
enable_n_char = 1'b1;
|
| 571 |
5 |
redbear |
end
|
| 572 |
17 |
redbear |
else
|
| 573 |
8 |
redbear |
begin
|
| 574 |
|
|
enable_null = 1'b1;
|
| 575 |
|
|
end
|
| 576 |
5 |
redbear |
end
|
| 577 |
|
|
endcase
|
| 578 |
|
|
|
| 579 |
|
|
end
|
| 580 |
|
|
|
| 581 |
|
|
always@(posedge pclk_tx)
|
| 582 |
|
|
begin
|
| 583 |
|
|
if(!enable_tx)
|
| 584 |
|
|
begin
|
| 585 |
13 |
redbear |
null_s <= 8'h74;
|
| 586 |
|
|
fct_s <= 4'h4;
|
| 587 |
|
|
eop_s <= 4'h5;
|
| 588 |
|
|
eep_s <= 4'h6;
|
| 589 |
|
|
timecode_s <= 14'b01110000000000;
|
| 590 |
5 |
redbear |
|
| 591 |
19 |
redbear |
fct_flag <= 3'd7;
|
| 592 |
6 |
redbear |
|
| 593 |
13 |
redbear |
first_time <= 1'b1;
|
| 594 |
|
|
ready_tx_data <= 1'b0;
|
| 595 |
|
|
ready_tx_timecode <= 1'b0;
|
| 596 |
8 |
redbear |
|
| 597 |
|
|
hold_null <= 1'b0;
|
| 598 |
|
|
hold_fct <= 1'b0;
|
| 599 |
|
|
hold_data <= 1'b0;
|
| 600 |
|
|
hold_time_code <= 1'b0;
|
| 601 |
|
|
|
| 602 |
5 |
redbear |
last_type <= NULL;
|
| 603 |
|
|
|
| 604 |
|
|
global_counter_transfer <= 4'd0;
|
| 605 |
|
|
txdata_flagctrl_tx_last <= 9'd0;
|
| 606 |
|
|
last_timein_control_flag_tx <= 8'd0;
|
| 607 |
6 |
redbear |
|
| 608 |
|
|
fct_counter_receive <= 6'd0;
|
| 609 |
17 |
redbear |
|
| 610 |
|
|
block_sum <= 1'b0;
|
| 611 |
19 |
redbear |
block_sum_fct_send <= 1'b0;
|
| 612 |
6 |
redbear |
|
| 613 |
5 |
redbear |
last_tx_dout <= 1'b0;
|
| 614 |
|
|
last_tx_sout <= 1'b0;
|
| 615 |
|
|
state_tx <= tx_spw_start;
|
| 616 |
17 |
redbear |
|
| 617 |
5 |
redbear |
end
|
| 618 |
|
|
else
|
| 619 |
|
|
begin
|
| 620 |
|
|
|
| 621 |
|
|
state_tx <= next_state_tx;
|
| 622 |
|
|
last_tx_dout <= tx_dout;
|
| 623 |
|
|
last_tx_sout <= tx_sout;
|
| 624 |
|
|
|
| 625 |
|
|
if(enable_null)
|
| 626 |
|
|
begin
|
| 627 |
6 |
redbear |
|
| 628 |
8 |
redbear |
ready_tx_data <= 1'b0;
|
| 629 |
13 |
redbear |
ready_tx_timecode <= 1'b0;
|
| 630 |
19 |
redbear |
//
|
| 631 |
17 |
redbear |
if(gotfct_tx && !block_sum)
|
| 632 |
|
|
begin
|
| 633 |
15 |
redbear |
fct_counter_receive <= fct_counter;
|
| 634 |
17 |
redbear |
block_sum<= 1'b1;
|
| 635 |
|
|
end
|
| 636 |
|
|
else if(!gotfct_tx)
|
| 637 |
|
|
begin
|
| 638 |
|
|
block_sum<= 1'b0;
|
| 639 |
|
|
end
|
| 640 |
|
|
else
|
| 641 |
|
|
block_sum <= block_sum;
|
| 642 |
6 |
redbear |
//
|
| 643 |
19 |
redbear |
if(send_fct_now && !block_sum_fct_send)
|
| 644 |
6 |
redbear |
begin
|
| 645 |
19 |
redbear |
fct_flag <= fct_send;
|
| 646 |
|
|
block_sum_fct_send<= 1'b1;
|
| 647 |
6 |
redbear |
end
|
| 648 |
19 |
redbear |
else if(!send_fct_now)
|
| 649 |
|
|
begin
|
| 650 |
|
|
block_sum_fct_send<= 1'b0;
|
| 651 |
|
|
end
|
| 652 |
|
|
else
|
| 653 |
|
|
block_sum_fct_send <= block_sum_fct_send;
|
| 654 |
6 |
redbear |
|
| 655 |
5 |
redbear |
if(first_time)
|
| 656 |
|
|
begin
|
| 657 |
|
|
first_time <= 1'b0;
|
| 658 |
8 |
redbear |
hold_null <= 1'b1;
|
| 659 |
5 |
redbear |
global_counter_transfer <= global_counter_transfer + 4'd1;
|
| 660 |
|
|
end
|
| 661 |
|
|
else if(global_counter_transfer != 4'd7)
|
| 662 |
|
|
begin
|
| 663 |
8 |
redbear |
hold_null <= 1'b1;
|
| 664 |
5 |
redbear |
global_counter_transfer <= global_counter_transfer + 4'd1;
|
| 665 |
|
|
end
|
| 666 |
|
|
else
|
| 667 |
|
|
begin
|
| 668 |
8 |
redbear |
hold_null <= 1'b0;
|
| 669 |
5 |
redbear |
global_counter_transfer <= 4'd0;
|
| 670 |
|
|
end
|
| 671 |
|
|
end
|
| 672 |
|
|
else if(enable_fct)
|
| 673 |
|
|
begin
|
| 674 |
8 |
redbear |
|
| 675 |
|
|
ready_tx_data <= 1'b0;
|
| 676 |
13 |
redbear |
ready_tx_timecode <= 1'b0;
|
| 677 |
8 |
redbear |
|
| 678 |
17 |
redbear |
if(gotfct_tx && !block_sum)
|
| 679 |
|
|
begin
|
| 680 |
15 |
redbear |
fct_counter_receive <= fct_counter;
|
| 681 |
17 |
redbear |
block_sum<= 1'b1;
|
| 682 |
|
|
end
|
| 683 |
|
|
else if(!gotfct_tx)
|
| 684 |
|
|
begin
|
| 685 |
|
|
block_sum<= 1'b0;
|
| 686 |
|
|
end
|
| 687 |
|
|
else
|
| 688 |
|
|
block_sum <= block_sum;
|
| 689 |
6 |
redbear |
|
| 690 |
|
|
|
| 691 |
5 |
redbear |
if(global_counter_transfer != 4'd3)
|
| 692 |
|
|
begin
|
| 693 |
8 |
redbear |
hold_fct <= 1'b1;
|
| 694 |
5 |
redbear |
global_counter_transfer <= global_counter_transfer + 4'd1;
|
| 695 |
19 |
redbear |
//
|
| 696 |
|
|
if(send_fct_now && !block_sum_fct_send)
|
| 697 |
|
|
begin
|
| 698 |
|
|
fct_flag <= fct_send;
|
| 699 |
|
|
block_sum_fct_send<= 1'b1;
|
| 700 |
|
|
end
|
| 701 |
|
|
else if(!send_fct_now)
|
| 702 |
|
|
begin
|
| 703 |
|
|
block_sum_fct_send<= 1'b0;
|
| 704 |
|
|
end
|
| 705 |
|
|
else
|
| 706 |
|
|
block_sum_fct_send <= block_sum_fct_send;
|
| 707 |
5 |
redbear |
end
|
| 708 |
|
|
else
|
| 709 |
|
|
begin
|
| 710 |
8 |
redbear |
hold_fct <= 1'b0;
|
| 711 |
5 |
redbear |
global_counter_transfer <= 4'd0;
|
| 712 |
6 |
redbear |
fct_flag <= fct_flag - 3'd1;
|
| 713 |
5 |
redbear |
end
|
| 714 |
|
|
end
|
| 715 |
|
|
else if(enable_time_code)
|
| 716 |
|
|
begin
|
| 717 |
8 |
redbear |
|
| 718 |
|
|
ready_tx_data <= 1'b0;
|
| 719 |
|
|
|
| 720 |
17 |
redbear |
if(gotfct_tx && !block_sum)
|
| 721 |
|
|
begin
|
| 722 |
15 |
redbear |
fct_counter_receive <= fct_counter;
|
| 723 |
17 |
redbear |
block_sum<= 1'b1;
|
| 724 |
|
|
end
|
| 725 |
|
|
else if(!gotfct_tx)
|
| 726 |
|
|
begin
|
| 727 |
|
|
block_sum<= 1'b0;
|
| 728 |
|
|
end
|
| 729 |
|
|
else
|
| 730 |
|
|
block_sum <= block_sum;
|
| 731 |
15 |
redbear |
|
| 732 |
13 |
redbear |
if(global_counter_transfer == 4'd13)
|
| 733 |
|
|
begin
|
| 734 |
|
|
ready_tx_timecode <= 1'b1;
|
| 735 |
|
|
end
|
| 736 |
19 |
redbear |
|
| 737 |
6 |
redbear |
//
|
| 738 |
19 |
redbear |
if(send_fct_now && !block_sum_fct_send)
|
| 739 |
6 |
redbear |
begin
|
| 740 |
19 |
redbear |
fct_flag <= fct_send;
|
| 741 |
|
|
block_sum_fct_send<= 1'b1;
|
| 742 |
6 |
redbear |
end
|
| 743 |
19 |
redbear |
else if(!send_fct_now)
|
| 744 |
|
|
begin
|
| 745 |
|
|
block_sum_fct_send<= 1'b0;
|
| 746 |
|
|
end
|
| 747 |
|
|
else
|
| 748 |
|
|
block_sum_fct_send <= block_sum_fct_send;
|
| 749 |
6 |
redbear |
|
| 750 |
5 |
redbear |
if(global_counter_transfer < 4'd13)
|
| 751 |
|
|
begin
|
| 752 |
|
|
global_counter_transfer <= global_counter_transfer + 4'd1;
|
| 753 |
13 |
redbear |
timecode_s <= {timecode_s[13:10],2'd2,timecode_tx_i[7:0]};
|
| 754 |
5 |
redbear |
end
|
| 755 |
|
|
else
|
| 756 |
|
|
begin
|
| 757 |
13 |
redbear |
last_timein_control_flag_tx <= timecode_tx_i;
|
| 758 |
5 |
redbear |
global_counter_transfer <= 4'd0;
|
| 759 |
|
|
end
|
| 760 |
|
|
end
|
| 761 |
|
|
else if(enable_n_char)
|
| 762 |
|
|
begin
|
| 763 |
8 |
redbear |
|
| 764 |
13 |
redbear |
ready_tx_timecode <= 1'b0;
|
| 765 |
|
|
|
| 766 |
6 |
redbear |
//
|
| 767 |
19 |
redbear |
if(send_fct_now && !block_sum_fct_send)
|
| 768 |
6 |
redbear |
begin
|
| 769 |
19 |
redbear |
fct_flag <= fct_send;
|
| 770 |
|
|
block_sum_fct_send<= 1'b1;
|
| 771 |
6 |
redbear |
end
|
| 772 |
19 |
redbear |
else if(!send_fct_now)
|
| 773 |
|
|
begin
|
| 774 |
|
|
block_sum_fct_send<= 1'b0;
|
| 775 |
|
|
end
|
| 776 |
|
|
else
|
| 777 |
|
|
block_sum_fct_send <= block_sum_fct_send;
|
| 778 |
6 |
redbear |
|
| 779 |
8 |
redbear |
if(!data_tx_i[8])
|
| 780 |
5 |
redbear |
begin
|
| 781 |
8 |
redbear |
|
| 782 |
|
|
if(global_counter_transfer == 4'd9)
|
| 783 |
|
|
begin
|
| 784 |
|
|
ready_tx_data <= 1'b1;
|
| 785 |
|
|
end
|
| 786 |
17 |
redbear |
else
|
| 787 |
|
|
begin
|
| 788 |
|
|
ready_tx_data <= 1'b0;
|
| 789 |
|
|
end
|
| 790 |
8 |
redbear |
|
| 791 |
|
|
if(global_counter_transfer != 4'd9)
|
| 792 |
|
|
begin
|
| 793 |
|
|
hold_data <= 1'b1;
|
| 794 |
|
|
global_counter_transfer <= global_counter_transfer + 4'd1;
|
| 795 |
|
|
txdata_flagctrl_tx_last <= data_tx_i;
|
| 796 |
17 |
redbear |
|
| 797 |
|
|
if(gotfct_tx && !block_sum)
|
| 798 |
|
|
begin
|
| 799 |
|
|
fct_counter_receive <= fct_counter;
|
| 800 |
|
|
block_sum<= 1'b1;
|
| 801 |
|
|
end
|
| 802 |
|
|
else if(!gotfct_tx)
|
| 803 |
|
|
begin
|
| 804 |
|
|
block_sum<= 1'b0;
|
| 805 |
|
|
end
|
| 806 |
|
|
else
|
| 807 |
|
|
block_sum <= block_sum;
|
| 808 |
8 |
redbear |
end
|
| 809 |
|
|
else
|
| 810 |
|
|
begin
|
| 811 |
|
|
hold_data <= 1'b0;
|
| 812 |
|
|
global_counter_transfer <= 4'd0;
|
| 813 |
15 |
redbear |
fct_counter_receive <= fct_counter_receive - 6'd1;
|
| 814 |
8 |
redbear |
end
|
| 815 |
|
|
|
| 816 |
5 |
redbear |
end
|
| 817 |
8 |
redbear |
else if(data_tx_i[8])
|
| 818 |
5 |
redbear |
begin
|
| 819 |
8 |
redbear |
|
| 820 |
|
|
if(global_counter_transfer == 4'd3)
|
| 821 |
|
|
begin
|
| 822 |
|
|
ready_tx_data <= 1'b1;
|
| 823 |
|
|
end
|
| 824 |
17 |
redbear |
else
|
| 825 |
|
|
begin
|
| 826 |
|
|
ready_tx_data <= 1'b0;
|
| 827 |
|
|
end
|
| 828 |
8 |
redbear |
|
| 829 |
|
|
if(global_counter_transfer != 4'd3)
|
| 830 |
|
|
begin
|
| 831 |
|
|
hold_data <= 1'b1;
|
| 832 |
|
|
global_counter_transfer <= global_counter_transfer + 4'd1;
|
| 833 |
|
|
txdata_flagctrl_tx_last <= data_tx_i;
|
| 834 |
17 |
redbear |
|
| 835 |
|
|
if(gotfct_tx && !block_sum)
|
| 836 |
|
|
begin
|
| 837 |
|
|
fct_counter_receive <= fct_counter;
|
| 838 |
|
|
block_sum<= 1'b1;
|
| 839 |
|
|
end
|
| 840 |
|
|
else if(!gotfct_tx)
|
| 841 |
|
|
begin
|
| 842 |
|
|
block_sum<= 1'b0;
|
| 843 |
|
|
end
|
| 844 |
|
|
else
|
| 845 |
|
|
block_sum <= block_sum;
|
| 846 |
8 |
redbear |
end
|
| 847 |
|
|
else
|
| 848 |
|
|
begin
|
| 849 |
15 |
redbear |
|
| 850 |
8 |
redbear |
hold_data <= 1'b0;
|
| 851 |
|
|
global_counter_transfer <= 4'd0;
|
| 852 |
15 |
redbear |
fct_counter_receive <= fct_counter_receive - 6'd1;
|
| 853 |
8 |
redbear |
end
|
| 854 |
5 |
redbear |
end
|
| 855 |
8 |
redbear |
|
| 856 |
5 |
redbear |
end
|
| 857 |
|
|
|
| 858 |
|
|
end
|
| 859 |
|
|
end
|
| 860 |
|
|
|
| 861 |
|
|
endmodule
|