OpenCores
URL https://opencores.org/ocsvn/spacewiresystemc/spacewiresystemc/trunk

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [rtl/] [RTL_VB/] [tx_spw.v] - Diff between revs 15 and 17

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 15 Rev 17
Line 103... Line 103...
        reg [5:0] fct_counter_receive;
        reg [5:0] fct_counter_receive;
 
 
        reg last_tx_dout;
        reg last_tx_dout;
        reg last_tx_sout;
        reg last_tx_sout;
 
 
 
        reg block_sum;
 
 
        reg [3:0] global_counter_transfer;
        reg [3:0] global_counter_transfer;
 
 
 
 
 
 
always@(*)
always@(*)
Line 437... Line 439...
                tx_sout = last_tx_sout;
                tx_sout = last_tx_sout;
        end
        end
 
 
end
end
 
 
//slots open in another side
always@(*)
always@(posedge gotfct_tx , negedge enable_tx)
 
begin
 
        if(!enable_tx)
 
        begin
 
                fct_counter <= 6'd0;
 
        end
 
        else
 
        begin
        begin
                if(fct_counter  < 6'd55)
        fct_counter = 6'd0;
 
 
 
        if(gotfct_tx)
                begin
                begin
                        if(enable_n_char && global_counter_transfer == 4'd9 && !data_tx_i[8])
                if(block_sum)
                        begin
                        begin
                                if(fct_counter < 6'd55)
 
                                        fct_counter <= fct_counter_receive + 6'd8 - 6'd1;
 
                                else
 
                                        fct_counter <= 6'd0;
 
                        end
                        end
                        else if(enable_n_char && global_counter_transfer == 4'd3 && data_tx_i[8])
 
                        begin
 
                                if(fct_counter < 6'd55)
 
                                        fct_counter <= fct_counter_receive + 6'd8 - 6'd1;
 
                                else
                                else
                                        fct_counter <= 6'd0;
 
                        end
 
                        else if(fct_counter == 6'd48)
 
                        begin
                        begin
                                if(fct_counter < 6'd55)
                        if(fct_counter_receive < 6'd48)
                                        fct_counter <= fct_counter_receive + 6'd7;
                        begin
                                else
                                fct_counter = fct_counter_receive + 6'd8;
                                        fct_counter <= 6'd0;
 
                        end
                        end
                        else
                        else
                        begin
                        begin
                                if(fct_counter < 6'd55)
                                fct_counter = fct_counter_receive + 6'd7;
                                        fct_counter <= fct_counter_receive + 6'd8;
 
                                else
 
                                        fct_counter <= 6'd0;
 
                        end
 
 
 
                end
                end
                else
 
                fct_counter <= 6'd0;
 
        end
        end
end
end
 
end
 
 
//slots open in our side
//slots open in our side
always@(posedge send_fct_now or negedge enable_tx)
always@(posedge send_fct_now or negedge enable_tx)
begin
begin
 
 
Line 511... Line 491...
 
 
 
 
always@(*)
always@(*)
begin
begin
 
 
        next_state_tx = state_tx;
 
 
 
        enable_null      = 1'b0;
        enable_null      = 1'b0;
        enable_fct       = 1'b0;
        enable_fct       = 1'b0;
        enable_n_char    = 1'b0;
        enable_n_char    = 1'b0;
        enable_time_code = 1'b0;
        enable_time_code = 1'b0;
 
 
 
        next_state_tx = state_tx;
 
 
        case(state_tx)
        case(state_tx)
        tx_spw_start:
        tx_spw_start:
        begin
        begin
                if(send_null_tx && enable_tx)
                if(send_null_tx && enable_tx)
                begin
                begin
Line 560... Line 541...
                        enable_fct  = 1'b1;
                        enable_fct  = 1'b1;
                end
                end
                else
                else
                begin
                begin
                        enable_fct = 1'b0;
                        enable_fct = 1'b0;
                        if(send_fct_tx && fct_counter > 6'd0)
                        if(send_fct_tx && fct_counter_receive > 6'd0)
                        begin
                        begin
                                //if(global_counter_transfer == 4'd7)
                                //if(global_counter_transfer == 4'd7)
                                        next_state_tx =  tx_spw_full;
                                        next_state_tx =  tx_spw_full;
                        end
                        end
 
 
                end
                end
        end
        end
        tx_spw_full:
        tx_spw_full:
        begin
        begin
 
 
                enable_null = 1'b0;
 
                enable_fct  = 1'b0;
 
                enable_n_char = 1'b0;
 
                enable_time_code = 1'b0;
 
 
 
                /*
 
                hold_null       <= 1'b0;
 
                hold_fct        <= 1'b0;
 
                hold_data       <= 1'b0;
 
                hold_time_code  <= 1'b0;
 
                */
 
 
 
                if(tickin_tx && !hold_null && !hold_fct && !hold_data)
                if(tickin_tx && !hold_null && !hold_fct && !hold_data)
                begin
                begin
                        enable_time_code = 1'b1;
                        enable_time_code = 1'b1;
                end
                end
                else if(fct_flag > 3'd0 && !hold_null && !hold_time_code && !hold_data)
                else if(fct_flag > 3'd0 && !hold_null && !hold_time_code && !hold_data)
                begin
                begin
                        enable_fct  = 1'b1;
                        enable_fct  = 1'b1;
                end
                end
                else if(txwrite_tx && fct_counter_receive > 6'd0 && !hold_null && !hold_time_code && !hold_fct )
                else if((txwrite_tx && fct_counter_receive > 6'd0 && !hold_null && !hold_time_code && !hold_fct) == 1'b1 )
                begin
                begin
                        enable_n_char = 1'b1;
                        enable_n_char = 1'b1;
                end
                end
                else if(!hold_time_code && !hold_fct && !hold_data)
                else
                begin
                begin
                        enable_null = 1'b1;
                        enable_null = 1'b1;
                end
                end
 
 
        end
        end
        endcase
        endcase
 
 
end
end
 
 
Line 634... Line 601...
                global_counter_transfer <= 4'd0;
                global_counter_transfer <= 4'd0;
                txdata_flagctrl_tx_last <= 9'd0;
                txdata_flagctrl_tx_last <= 9'd0;
                last_timein_control_flag_tx <= 8'd0;
                last_timein_control_flag_tx <= 8'd0;
 
 
                fct_counter_receive <= 6'd0;
                fct_counter_receive <= 6'd0;
                //fct_counter_update <= 6'd0;
 
                //fct_counter_last <= 6'd0;
                block_sum  <= 1'b0;
 
 
                last_tx_dout      <= 1'b0;
                last_tx_dout      <= 1'b0;
                last_tx_sout      <= 1'b0;
                last_tx_sout      <= 1'b0;
                state_tx <= tx_spw_start;
                state_tx <= tx_spw_start;
 
 
        end
        end
        else
        else
        begin
        begin
 
 
                state_tx <= next_state_tx;
                state_tx <= next_state_tx;
Line 654... Line 622...
                begin
                begin
 
 
                        ready_tx_data <= 1'b0;
                        ready_tx_data <= 1'b0;
                        ready_tx_timecode <= 1'b0;
                        ready_tx_timecode <= 1'b0;
 
 
                        if(fct_counter > 6'd0)
                        if(gotfct_tx && !block_sum)
 
                        begin
                                fct_counter_receive <= fct_counter;
                                fct_counter_receive <= fct_counter;
 
                                block_sum<= 1'b1;
 
                        end
 
                        else if(!gotfct_tx)
 
                        begin
 
                                block_sum<= 1'b0;
 
                        end
 
                        else
 
                                block_sum <= block_sum;
 
 
                        //
                        //
                        if(fct_send_last != fct_send)
                        if(fct_send_last != fct_send)
                        begin
                        begin
                                if(fct_send == 3'd1 && fct_send_last == 3'd7)
                                if(fct_send == 3'd1 && fct_send_last == 3'd7)
                                begin
                                begin
Line 694... Line 672...
                begin
                begin
 
 
                        ready_tx_data <= 1'b0;
                        ready_tx_data <= 1'b0;
                        ready_tx_timecode <= 1'b0;
                        ready_tx_timecode <= 1'b0;
 
 
                        if(fct_counter > 6'd0)
                        if(gotfct_tx && !block_sum)
 
                        begin
                                fct_counter_receive <= fct_counter;
                                fct_counter_receive <= fct_counter;
 
                                block_sum<= 1'b1;
 
                        end
 
                        else if(!gotfct_tx)
 
                        begin
 
                                block_sum<= 1'b0;
 
                        end
 
                        else
 
                                block_sum <= block_sum;
 
 
 
 
                        if(global_counter_transfer != 4'd3)
                        if(global_counter_transfer != 4'd3)
                        begin
                        begin
                                hold_fct <= 1'b1;
                                hold_fct <= 1'b1;
Line 715... Line 702...
                else if(enable_time_code)
                else if(enable_time_code)
                begin
                begin
 
 
                        ready_tx_data <= 1'b0;
                        ready_tx_data <= 1'b0;
 
 
                        if(fct_counter > 6'd0)
                        if(gotfct_tx && !block_sum)
 
                        begin
                                fct_counter_receive <= fct_counter;
                                fct_counter_receive <= fct_counter;
 
                                block_sum<= 1'b1;
 
                        end
 
                        else if(!gotfct_tx)
 
                        begin
 
                                block_sum<= 1'b0;
 
                        end
 
                        else
 
                                block_sum <= block_sum;
 
 
 
 
                        if(global_counter_transfer == 4'd13)
                        if(global_counter_transfer == 4'd13)
                        begin
                        begin
                                ready_tx_timecode <= 1'b1;
                                ready_tx_timecode <= 1'b1;
Line 778... Line 774...
 
 
                                if(global_counter_transfer == 4'd9)
                                if(global_counter_transfer == 4'd9)
                                begin
                                begin
                                        ready_tx_data <= 1'b1;
                                        ready_tx_data <= 1'b1;
                                end
                                end
 
                                else
 
                                begin
 
                                        ready_tx_data <= 1'b0;
 
                                end
 
 
                                if(global_counter_transfer != 4'd9)
                                if(global_counter_transfer != 4'd9)
                                begin
                                begin
                                        hold_data <= 1'b1;
                                        hold_data <= 1'b1;
                                        global_counter_transfer <= global_counter_transfer + 4'd1;
                                        global_counter_transfer <= global_counter_transfer + 4'd1;
                                        txdata_flagctrl_tx_last <= data_tx_i;
                                        txdata_flagctrl_tx_last <= data_tx_i;
 
 
 
                                        if(gotfct_tx && !block_sum)
 
                                        begin
 
                                                fct_counter_receive <= fct_counter;
 
                                                block_sum<= 1'b1;
 
                                        end
 
                                        else if(!gotfct_tx)
 
                                        begin
 
                                                block_sum<= 1'b0;
 
                                        end
 
                                        else
 
                                                block_sum <= block_sum;
                                end
                                end
                                else
                                else
                                begin
                                begin
                                        hold_data <= 1'b0;
                                        hold_data <= 1'b0;
                                        global_counter_transfer <= 4'd0;
                                        global_counter_transfer <= 4'd0;
                                        //
 
                                        fct_counter_receive <= fct_counter_receive - 6'd1;
                                        fct_counter_receive <= fct_counter_receive - 6'd1;
 
 
                                end
                                end
 
 
                        end
                        end
                        else if(data_tx_i[8])
                        else if(data_tx_i[8])
                        begin
                        begin
 
 
                                if(global_counter_transfer == 4'd3)
                                if(global_counter_transfer == 4'd3)
                                begin
                                begin
                                        ready_tx_data <= 1'b1;
                                        ready_tx_data <= 1'b1;
                                end
                                end
 
                                else
 
                                begin
 
                                        ready_tx_data <= 1'b0;
 
                                end
 
 
                                if(global_counter_transfer != 4'd3)
                                if(global_counter_transfer != 4'd3)
                                begin
                                begin
                                        hold_data <= 1'b1;
                                        hold_data <= 1'b1;
                                        global_counter_transfer <= global_counter_transfer + 4'd1;
                                        global_counter_transfer <= global_counter_transfer + 4'd1;
                                        txdata_flagctrl_tx_last <= data_tx_i;
                                        txdata_flagctrl_tx_last <= data_tx_i;
 
 
 
                                        if(gotfct_tx && !block_sum)
 
                                        begin
 
                                                fct_counter_receive <= fct_counter;
 
                                                block_sum<= 1'b1;
 
                                        end
 
                                        else if(!gotfct_tx)
 
                                        begin
 
                                                block_sum<= 1'b0;
 
                                        end
 
                                        else
 
                                                block_sum <= block_sum;
                                end
                                end
                                else
                                else
                                begin
                                begin
 
 
                                        hold_data <= 1'b0;
                                        hold_data <= 1'b0;
                                        global_counter_transfer <= 4'd0;
                                        global_counter_transfer <= 4'd0;
 
 
 
 
                                        fct_counter_receive <= fct_counter_receive - 6'd1;
                                        fct_counter_receive <= fct_counter_receive - 6'd1;
 
 
                                end
                                end
                        end
                        end
 
 
                end
                end
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.