Line 40... |
Line 40... |
input rx_resetn,
|
input rx_resetn,
|
|
|
output rx_error,
|
output rx_error,
|
|
|
output reg rx_got_bit,
|
output reg rx_got_bit,
|
output reg rx_got_null,
|
output rx_got_null,
|
output reg rx_got_nchar,
|
output rx_got_nchar,
|
output reg rx_got_time_code,
|
output rx_got_time_code,
|
output reg rx_got_fct,
|
output rx_got_fct,
|
output reg rx_got_fct_fsm,
|
output rx_got_fct_fsm,
|
|
|
output reg [8:0] rx_data_flag,
|
output [8:0] rx_data_flag,
|
output reg rx_buffer_write,
|
output rx_buffer_write,
|
|
|
output [7:0] rx_time_out,
|
output [7:0] rx_time_out,
|
output reg rx_tick_out
|
output rx_tick_out
|
);
|
);
|
|
|
|
|
reg [5:0] counter_neg;
|
wire [5:0] counter_neg/* synthesis syn_replicate = 0 */;
|
reg control_bit_found;
|
|
reg data_bit_found;
|
|
|
|
wire posedge_clk;
|
wire posedge_clk;
|
wire negedge_clk;
|
wire negedge_clk;
|
|
|
reg [1:0] state_data_process;
|
wire bit_c_0;//N
|
reg [1:0] next_state_data_process;
|
wire bit_c_1;//P
|
|
wire bit_c_2;//N
|
|
wire bit_c_3;//P
|
|
|
|
wire bit_d_0;//N
|
|
wire bit_d_1;//P
|
|
wire bit_d_2;//N
|
|
wire bit_d_3;//P
|
|
wire bit_d_4;//N
|
|
wire bit_d_5;//P
|
|
wire bit_d_6;//N
|
|
wire bit_d_7;//P
|
|
wire bit_d_8;//N
|
|
wire bit_d_9;//P
|
|
|
|
wire [1:0] state_data_process;
|
|
|
|
wire is_control/* synthesis dont_replicate */;
|
|
wire last_is_control;
|
|
wire last_is_data;
|
|
wire last_is_timec;
|
|
|
reg bit_c_0;//N
|
wire [2:0] control_p_r/* synthesis dont_replicate */;
|
reg bit_c_1;//P
|
wire [7:0] timecode/* synthesis dont_replicate */;
|
reg bit_c_2;//N
|
|
reg bit_c_3;//P
|
|
|
|
reg bit_d_0;//N
|
|
reg bit_d_1;//P
|
|
reg bit_d_2;//N
|
|
reg bit_d_3;//P
|
|
reg bit_d_4;//N
|
|
reg bit_d_5;//P
|
|
reg bit_d_6;//N
|
|
reg bit_d_7;//P
|
|
reg bit_d_8;//N
|
|
reg bit_d_9;//P
|
|
|
|
reg is_control;
|
|
reg parity_received;
|
|
|
|
reg last_is_control;
|
|
reg last_is_data;
|
|
reg last_is_timec;
|
|
|
|
reg [3:0] control;
|
|
reg [3:0] control_r;
|
|
reg [3:0] control_p_r;
|
|
reg [9:0] data;
|
|
reg [9:0] timecode;
|
|
|
|
reg [3:0] control_l_r;
|
wire [2:0] control_l_r/* synthesis dont_replicate */;
|
|
|
reg [9:0] dta_timec;
|
wire [8:0] dta_timec_p/* synthesis dont_replicate */;
|
reg [9:0] dta_timec_p;
|
|
|
|
reg ready_control;
|
reg ready_control;
|
reg ready_data;
|
reg ready_data;
|
|
|
reg ready_control_p;
|
wire ready_control_p_r;
|
reg ready_data_p;
|
wire ready_data_p_r;
|
|
|
reg ready_control_p_r;
|
wire parity_rec_c;
|
reg ready_data_p_r;
|
wire parity_rec_d;
|
|
|
reg parity_rec_c;
|
wire parity_rec_c_gen;
|
reg parity_rec_d;
|
wire parity_rec_d_gen;
|
|
|
reg rx_error_c;
|
wire rx_error_c;
|
reg rx_error_d;
|
wire rx_error_d;
|
|
|
reg posedge_p;
|
wire posedge_p/* synthesis syn_replicate = 0 */;
|
|
|
|
reg f_time;
|
|
|
//CLOCK RECOVERY
|
//CLOCK RECOVERY
|
assign posedge_clk = posedge_p;
|
assign posedge_clk = posedge_p;
|
assign negedge_clk = !posedge_p;
|
assign negedge_clk = (f_time)?!posedge_p:1'b0;
|
|
|
assign rx_time_out = timecode[7:0];
|
|
|
|
assign rx_error = rx_error_c | rx_error_d;
|
|
|
|
always@(*)
|
|
begin
|
|
|
|
rx_got_bit = 1'b0;
|
|
|
|
if(rx_din | rx_sin)
|
|
begin
|
|
rx_got_bit = 1'b1;
|
|
end
|
|
end
|
|
|
|
always@(*)
|
|
begin
|
|
ready_control = 1'b0;
|
|
ready_data = 1'b0;
|
|
|
|
if(counter_neg[5:0] == 6'd4 && !posedge_p)
|
|
begin
|
|
ready_control = 1'b1;
|
|
end
|
|
else if(counter_neg[5:0] == 6'd32 && !posedge_p)
|
|
begin
|
|
ready_data = 1'b1;
|
|
end
|
|
end
|
|
|
|
|
|
always@(*)
|
|
begin
|
|
ready_control_p = 1'b0;
|
|
ready_data_p = 1'b0;
|
|
|
|
if(counter_neg[5:0] == 6'd4 && posedge_p)
|
|
begin
|
|
ready_control_p = 1'b1;
|
|
end
|
|
else if(counter_neg[5:0] == 6'd32 && posedge_p)
|
|
begin
|
|
ready_data_p = 1'b1;
|
|
end
|
|
end
|
|
|
|
always@(*)
|
|
begin
|
|
posedge_p = 1'b0;
|
|
|
|
if(rx_din ^ rx_sin)
|
assign rx_time_out = timecode;
|
begin
|
|
posedge_p = 1'b1;
|
|
end
|
|
else
|
|
begin
|
|
posedge_p = 1'b0;
|
|
end
|
|
end
|
|
|
|
always@(posedge posedge_clk or negedge rx_resetn)
|
|
begin
|
|
|
|
if(!rx_resetn)
|
|
begin
|
|
bit_d_1 <= 1'b0;
|
|
bit_d_3 <= 1'b0;
|
|
bit_d_5 <= 1'b0;
|
|
bit_d_7 <= 1'b0;
|
|
bit_d_9 <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
bit_d_1 <= rx_din;
|
|
bit_d_3 <= bit_d_1;
|
|
bit_d_5 <= bit_d_3;
|
|
bit_d_7 <= bit_d_5;
|
|
bit_d_9 <= bit_d_7;
|
|
end
|
|
|
|
end
|
|
|
|
always@(posedge negedge_clk or negedge rx_resetn)
|
|
begin
|
|
|
|
if(!rx_resetn)
|
buf (posedge_p,rx_din ^ rx_sin);
|
begin
|
|
bit_d_0 <= 1'b0;
|
|
bit_d_2 <= 1'b0;
|
|
bit_d_4 <= 1'b0;
|
|
bit_d_6 <= 1'b0;
|
|
bit_d_8 <= 1'b0;
|
|
|
|
end
|
|
else
|
|
begin
|
|
bit_d_0 <= rx_din;
|
|
bit_d_2 <= bit_d_0;
|
|
bit_d_4 <= bit_d_2;
|
|
bit_d_6 <= bit_d_4;
|
|
bit_d_8 <= bit_d_6;
|
|
end
|
|
end
|
|
|
|
always@(posedge posedge_clk or negedge rx_resetn)
|
always@(posedge posedge_clk or negedge rx_resetn)
|
begin
|
begin
|
|
|
if(!rx_resetn)
|
if(!rx_resetn)
|
begin
|
begin
|
bit_c_1 <= 1'b0;
|
f_time <= 1'b0;
|
bit_c_3 <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
bit_c_1 <= rx_din;
|
|
bit_c_3 <= bit_c_1;
|
|
end
|
|
|
|
end
|
|
|
|
always@(posedge negedge_clk or negedge rx_resetn)
|
|
begin
|
|
|
|
if(!rx_resetn)
|
|
begin
|
|
bit_c_0 <= 1'b0;
|
|
bit_c_2 <= 1'b0;
|
|
end
|
end
|
else
|
else
|
begin
|
begin
|
bit_c_0 <= rx_din;
|
f_time <= 1'b1;
|
bit_c_2 <= bit_c_0;
|
|
end
|
end
|
end
|
end
|
|
|
always@(posedge negedge_clk or negedge rx_resetn)
|
always@(*)
|
begin
|
|
|
|
if(!rx_resetn)
|
|
begin
|
|
rx_got_fct <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
if(control_l_r[2:0] != 3'd7 && control[2:0] == 3'd4 && (ready_control_p_r))
|
|
begin
|
|
rx_got_fct <= 1'b1;
|
|
end
|
|
else
|
|
begin
|
|
rx_got_fct <= 1'b0;
|
|
end
|
|
end
|
|
end
|
|
|
|
always@(posedge negedge_clk or negedge rx_resetn)
|
|
begin
|
|
|
|
if(!rx_resetn)
|
|
begin
|
|
rx_got_null <= 1'b0;
|
|
rx_got_nchar <= 1'b0;
|
|
rx_got_time_code <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
if(last_is_data == 1'b1 )
|
|
begin
|
|
rx_got_nchar <= 1'b1;
|
|
end
|
|
else if(last_is_timec == 1'b1)
|
|
begin
|
|
rx_got_time_code <= 1'b1;
|
|
end
|
|
else if(last_is_control == 1'b1)
|
|
begin
|
|
rx_got_null <= 1'b1;
|
|
end
|
|
else
|
|
begin
|
|
rx_got_null <= 1'b0;
|
|
rx_got_nchar <= 1'b0;
|
|
rx_got_time_code <= 1'b0;
|
|
end
|
|
end
|
|
end
|
|
|
|
always@(posedge negedge_clk or negedge rx_resetn)
|
|
begin
|
|
if(!rx_resetn)
|
|
begin
|
|
rx_got_fct_fsm <= 1'b0;
|
|
ready_control_p_r <= 1'b0;
|
|
ready_data_p_r <= 1'b0;
|
|
|
|
end
|
|
else
|
|
begin
|
|
|
|
if(ready_control || ready_control_p)
|
|
begin
|
|
if(is_control)
|
|
ready_control_p_r <= 1'b1;
|
|
else
|
|
ready_control_p_r <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
ready_control_p_r <= 1'b0;
|
|
end
|
|
|
|
if(ready_data || ready_data_p)
|
|
begin
|
|
if(!is_control)
|
|
ready_data_p_r <= 1'b1;
|
|
else
|
|
ready_data_p_r <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
ready_data_p_r <= 1'b0;
|
|
end
|
|
|
|
if((control_l_r[2:0] != 3'd7 && control[2:0] == 3'd4 && last_is_control == 1'b1 ) == 1'b1)
|
|
rx_got_fct_fsm <= 1'b1;
|
|
else
|
|
rx_got_fct_fsm <= rx_got_fct_fsm;
|
|
end
|
|
end
|
|
|
|
always@(posedge ready_control or negedge rx_resetn )
|
|
begin
|
|
if(!rx_resetn)
|
|
begin
|
|
control_r <= 4'd0;
|
|
parity_rec_c <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
control_r <= {bit_c_3,bit_c_2,bit_c_1,bit_c_0};
|
|
parity_rec_c <= bit_c_3;
|
|
end
|
|
end
|
|
|
|
always@(posedge ready_control_p or negedge rx_resetn )
|
|
begin
|
|
if(!rx_resetn)
|
|
begin
|
|
control_p_r <= 4'd0;
|
|
|
|
end
|
|
else
|
|
begin
|
begin
|
control_p_r <= control_r;
|
|
end
|
|
end
|
|
|
|
|
|
|
rx_got_bit = 1'b0;
|
|
|
always@(posedge ready_data or negedge rx_resetn )
|
if(rx_din | rx_sin)
|
begin
|
|
if(!rx_resetn)
|
|
begin
|
|
dta_timec <= 10'd0;
|
|
parity_rec_d <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
begin
|
dta_timec <= {bit_d_9,bit_d_8,bit_d_0,bit_d_1,bit_d_2,bit_d_3,bit_d_4,bit_d_5,bit_d_6,bit_d_7};
|
rx_got_bit = 1'b1;
|
parity_rec_d <= bit_d_9;
|
|
end
|
end
|
end
|
end
|
|
|
|
|
always@(posedge ready_data_p or negedge rx_resetn )
|
always@(*)
|
begin
|
|
if(!rx_resetn)
|
|
begin
|
|
dta_timec_p <= 10'd0;
|
|
end
|
|
else
|
|
begin
|
|
dta_timec_p <= dta_timec;
|
|
end
|
|
end
|
|
|
|
always@(posedge ready_data_p or negedge rx_resetn )
|
|
begin
|
begin
|
|
ready_control = 1'b0;
|
|
ready_data = 1'b0;
|
|
|
if(!rx_resetn)
|
if(is_control && counter_neg == 6'd4 && !posedge_p)
|
begin
|
|
rx_error_d <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
if(last_is_control)
|
|
begin
|
begin
|
if(!(dta_timec[8]^control[0]^control[1]) != parity_rec_d)
|
ready_control = 1'b1;
|
begin
|
ready_data = 1'b0;
|
rx_error_d <= 1'b1;
|
|
end
|
|
end
|
end
|
else if(last_is_data)
|
else if(!is_control && counter_neg == 6'd32 && !posedge_p)
|
begin
|
|
if(!(dta_timec[8]^data[7]^data[6]^data[5]^data[4]^data[3]^data[2]^data[1]^data[0]) != parity_rec_d)
|
|
begin
|
begin
|
rx_error_d <= 1'b1;
|
ready_control = 1'b0;
|
end
|
ready_data = 1'b1;
|
end
|
|
end
|
end
|
end
|
end
|
|
|
always@(posedge ready_control_p or negedge rx_resetn )
|
|
begin
|
|
|
|
if(!rx_resetn)
|
rx_buffer_fsm buffer_fsm(
|
begin
|
.posedge_clk(posedge_clk),
|
rx_error_c <= 1'b0;
|
.rx_resetn(rx_resetn),
|
|
|
|
.last_is_data(last_is_data),
|
|
.last_is_timec(last_is_timec),
|
|
.last_is_control(last_is_control),
|
|
|
|
.rx_got_null(rx_got_null),
|
|
.rx_got_nchar(rx_got_nchar),
|
|
.rx_got_time_code(rx_got_time_code)
|
|
);
|
|
|
end
|
rx_data_buffer_data_w buffer_data_flag(
|
else
|
.negedge_clk(negedge_clk),
|
begin
|
.rx_resetn(rx_resetn),
|
if(last_is_control)
|
|
begin
|
.state_data_process(state_data_process),
|
if(!(control_r[2]^control[0]^control[1]) != parity_rec_c)
|
.control(control_p_r),
|
begin
|
.last_is_timec(last_is_timec),
|
rx_error_c <= 1'b1;
|
.last_is_data(last_is_data),
|
end
|
.last_is_control(last_is_control),
|
end
|
|
else if(last_is_data)
|
|
begin
|
|
if(!(control_r[2]^data[7]^data[6]^data[5]^data[4]^data[3]^data[2]^data[1]^data[0]) != parity_rec_c)
|
|
begin
|
|
rx_error_c <= 1'b1;
|
|
end
|
|
end
|
|
end
|
|
|
|
end
|
.rx_buffer_write(rx_buffer_write),
|
|
.rx_tick_out(rx_tick_out)
|
|
|
always@(posedge negedge_clk or negedge rx_resetn)
|
);
|
begin
|
|
|
|
if(!rx_resetn)
|
|
begin
|
|
rx_buffer_write <= 1'b0;
|
|
rx_tick_out <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
|
|
if(!ready_control_p_r && !ready_data_p_r && !ready_control && !ready_data)
|
rx_control_data_rdy control_data_rdy(
|
begin
|
.posedge_clk(posedge_clk),
|
if(last_is_timec == 1'b1)
|
.rx_resetn(rx_resetn),
|
begin
|
|
rx_tick_out <= 1'b1;
|
|
end
|
|
else if(last_is_data == 1'b1)
|
|
begin
|
|
rx_buffer_write <= 1'b1;
|
|
end
|
|
else if(last_is_control == 1'b1)
|
|
begin
|
|
if(control[2:0] == 3'd6)
|
|
begin
|
|
rx_buffer_write <= 1'b1;
|
|
end
|
|
else if(control[2:0] == 3'd5)
|
|
begin
|
|
rx_buffer_write <= 1'b1;
|
|
end
|
|
end
|
|
end
|
|
else
|
|
begin
|
|
rx_buffer_write <= 1'b0;
|
|
rx_tick_out <= 1'b0;
|
|
end
|
|
end
|
|
end
|
|
|
|
|
.rx_error_c(rx_error_c),
|
|
.rx_error_d(rx_error_d),
|
|
|
always@(posedge negedge_clk or negedge rx_resetn)
|
.control(control_p_r),
|
begin
|
.control_l_r(control_l_r[2:0]),
|
|
|
if(!rx_resetn)
|
.is_control(is_control),
|
begin
|
.counter_neg(counter_neg),
|
is_control <= 1'b0;
|
|
control_bit_found <= 1'b0;
|
|
counter_neg[5:0] <= 6'd1;
|
|
end
|
|
else
|
|
begin
|
|
|
|
control_bit_found <= rx_din;
|
.last_is_control(last_is_control),
|
|
|
case(counter_neg)
|
.rx_error(rx_error),
|
6'd1:
|
.ready_control_p_r(ready_control_p_r),
|
begin
|
.ready_data_p_r(ready_data_p_r),
|
counter_neg[5:0] <= 6'd2;
|
.rx_got_fct_fsm(rx_got_fct_fsm)
|
end
|
);
|
6'd2:
|
|
begin
|
|
if(control_bit_found == 1'b1)
|
|
begin
|
|
is_control <= 1'b1;
|
|
end
|
|
else
|
|
begin
|
|
is_control <= 1'b0;
|
|
end
|
|
|
|
counter_neg[5:0] <= 6'd4;
|
|
end
|
|
6'd4:
|
|
begin
|
|
if(is_control == 1'b1)
|
|
begin
|
|
counter_neg[5:0] <= 6'd2;
|
|
is_control <= 1'b0;
|
|
end
|
|
else
|
|
begin
|
|
counter_neg[5:0] <= 6'd8;
|
|
end
|
|
end
|
|
6'd8:
|
|
begin
|
|
counter_neg[5:0] <= 6'd16;
|
|
end
|
|
6'd16:
|
|
begin
|
|
counter_neg[5:0] <= 6'd32;
|
|
end
|
|
6'd32:
|
|
begin
|
|
is_control <= 1'b0;
|
|
counter_neg[5:0] <= 6'd2;
|
|
end
|
|
default:
|
|
begin
|
|
is_control <= is_control;
|
|
counter_neg[5:0] <= counter_neg[5:0];
|
|
end
|
|
endcase
|
|
|
|
end
|
|
end
|
|
|
|
always@(*)
|
rx_data_control_p data_control(
|
begin
|
.posedge_clk(posedge_clk),
|
|
.rx_resetn(rx_resetn),
|
|
|
|
.bit_c_3(bit_c_3),
|
|
.bit_c_2(bit_c_2),
|
|
.bit_c_1(bit_c_1),
|
|
.bit_c_0(bit_c_0),
|
|
|
|
.bit_d_9(bit_d_9),
|
|
.bit_d_8(bit_d_8),
|
|
.bit_d_0(bit_d_0),
|
|
.bit_d_1(bit_d_1),
|
|
.bit_d_2(bit_d_2),
|
|
.bit_d_3(bit_d_3),
|
|
.bit_d_4(bit_d_4),
|
|
.bit_d_5(bit_d_5),
|
|
.bit_d_6(bit_d_6),
|
|
.bit_d_7(bit_d_7),
|
|
|
|
.last_is_control(last_is_control),
|
|
.last_is_data(last_is_data),
|
|
|
|
.is_control(is_control),
|
|
.counter_neg(counter_neg),
|
|
|
|
.dta_timec_p(dta_timec_p),
|
|
.parity_rec_d(parity_rec_d),
|
|
.parity_rec_d_gen(parity_rec_d_gen),
|
|
|
|
.control_p_r(control_p_r),
|
|
.control_l_r(control_l_r),
|
|
.parity_rec_c(parity_rec_c),
|
|
.parity_rec_c_gen(parity_rec_c_gen)
|
|
);
|
|
|
next_state_data_process = state_data_process;
|
|
|
|
case(state_data_process)
|
bit_capture_data capture_d(
|
2'd0:
|
.negedge_clk(negedge_clk),
|
begin
|
.posedge_clk(posedge_clk),
|
if(ready_control_p_r || ready_data_p_r)
|
.rx_resetn(rx_resetn),
|
begin
|
|
next_state_data_process = 2'd1;
|
.rx_din(rx_din),
|
end
|
|
else
|
.bit_d_0(bit_d_0),//N
|
begin
|
.bit_d_1(bit_d_1),//P
|
next_state_data_process = 2'd0;
|
.bit_d_2(bit_d_2),//N
|
end
|
.bit_d_3(bit_d_3),//P
|
end
|
.bit_d_4(bit_d_4),//N
|
2'd1:
|
.bit_d_5(bit_d_5),//P
|
begin
|
.bit_d_6(bit_d_6),//N
|
next_state_data_process = 2'd0;
|
.bit_d_7(bit_d_7),//P
|
end
|
.bit_d_8(bit_d_8),//N
|
default:
|
.bit_d_9(bit_d_9)//P
|
begin
|
);
|
next_state_data_process = 2'd0;
|
|
end
|
|
endcase
|
|
end
|
|
|
|
|
bit_capture_control capture_c(
|
|
.negedge_clk(negedge_clk),
|
|
.posedge_clk(posedge_clk),
|
|
.rx_resetn(rx_resetn),
|
|
|
|
.rx_din(rx_din),
|
|
|
|
.bit_c_0(bit_c_0),
|
|
.bit_c_1(bit_c_1),
|
|
.bit_c_2(bit_c_2),
|
|
.bit_c_3(bit_c_3)
|
|
);
|
|
|
always@(posedge negedge_clk or negedge rx_resetn )
|
counter_neg cnt_neg(
|
begin
|
.negedge_clk(negedge_clk),
|
|
.rx_resetn(rx_resetn),
|
|
.rx_din(rx_din),
|
|
.is_control(is_control),
|
|
.counter_neg(counter_neg)
|
|
);
|
|
|
if(!rx_resetn)
|
rx_data_receive rx_dtarcv (
|
begin
|
.posedge_clk(posedge_clk),
|
control_l_r <= 4'd0;
|
.rx_resetn(rx_resetn),
|
control <= 4'd0;
|
|
data <= 10'd0;
|
|
|
|
last_is_control <= 1'b0;
|
|
last_is_data <= 1'b0;
|
|
last_is_timec <= 1'b0;
|
|
|
|
rx_data_flag <= 9'd0;
|
.ready_control_p_r(ready_control_p_r),
|
timecode <= 10'd0;
|
.ready_data_p_r(ready_data_p_r),
|
|
.ready_control(ready_control),
|
|
.ready_data(ready_data),
|
|
|
state_data_process <= 2'd0;
|
.parity_rec_c(parity_rec_c),
|
end
|
.parity_rec_d(parity_rec_d),
|
else
|
|
begin
|
|
|
|
state_data_process <= next_state_data_process;
|
.parity_rec_c_gen(parity_rec_c_gen),
|
|
.parity_rec_d_gen(parity_rec_d_gen),
|
|
|
case(state_data_process)
|
.control_p_r(control_p_r),
|
2'd0:
|
.dta_timec_p(dta_timec_p),
|
begin
|
|
|
|
if(ready_control_p_r)
|
.control_l_r(control_l_r),
|
begin
|
.state_data_process(state_data_process),
|
control <= control_p_r;
|
|
control_l_r <= control;
|
|
|
|
if(control_p_r[2:0] == 3'd6)
|
.last_is_control(last_is_control),
|
begin
|
.last_is_data(last_is_data),
|
rx_data_flag <= 9'd257;
|
.last_is_timec(last_is_timec),
|
end
|
|
else if(control_p_r[2:0] == 3'd5)
|
|
begin
|
|
rx_data_flag <= 9'd256;
|
|
end
|
|
else
|
|
begin
|
|
rx_data_flag <= rx_data_flag;
|
|
end
|
|
|
|
last_is_control <= 1'b1;
|
.rx_error_c(rx_error_c),
|
last_is_data <= 1'b0;
|
.rx_error_d(rx_error_d),
|
last_is_timec <= 1'b0;
|
.rx_got_fct(rx_got_fct),
|
|
|
end
|
.rx_data_flag(rx_data_flag),
|
else if(ready_data_p_r)
|
|
begin
|
|
if(control[2:0] != 3'd7)
|
|
begin
|
|
data <= {dta_timec_p[9],dta_timec_p[8],dta_timec_p[7],dta_timec_p[6],dta_timec_p[5],dta_timec_p[4],dta_timec_p[3],dta_timec_p[2],dta_timec_p[1],dta_timec_p[0]};
|
|
rx_data_flag <= {dta_timec_p[8],dta_timec_p[7],dta_timec_p[6],dta_timec_p[5],dta_timec_p[4],dta_timec_p[3],dta_timec_p[2],dta_timec_p[1],dta_timec_p[0]};
|
|
last_is_control <=1'b0;
|
|
last_is_data <=1'b1;
|
|
last_is_timec <=1'b0;
|
|
end
|
|
else if(control[2:0] == 3'd7)
|
|
begin
|
|
timecode <= {dta_timec_p[9],dta_timec_p[8],dta_timec_p[7],dta_timec_p[6],dta_timec_p[5],dta_timec_p[4],dta_timec_p[3],dta_timec_p[2],dta_timec_p[1],dta_timec_p[0]};
|
|
last_is_control <= 1'b0;
|
|
last_is_data <= 1'b0;
|
|
last_is_timec <= 1'b1;
|
|
end
|
|
end
|
|
else
|
|
begin
|
|
timecode <= timecode;
|
|
end
|
|
|
|
end
|
.timecode(timecode)
|
2'd1:
|
);
|
begin
|
|
rx_data_flag <= rx_data_flag;
|
|
timecode <= timecode;
|
|
end
|
|
default:
|
|
begin
|
|
rx_data_flag <= rx_data_flag;
|
|
timecode <= timecode;
|
|
|
|
end
|
|
endcase
|
|
end
|
|
end
|
|
|
|
endmodule
|
endmodule
|
|
|
No newline at end of file
|
No newline at end of file
|