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

Subversion Repositories spacewiresystemc

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

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

Rev 17 Rev 19
Line 94... Line 94...
        reg enable_fct;
        reg enable_fct;
        reg enable_n_char;
        reg enable_n_char;
        reg enable_time_code;
        reg enable_time_code;
 
 
        reg [2:0] fct_send;
        reg [2:0] fct_send;
        reg [2:0] fct_send_last;
 
        reg [2:0] fct_flag;
        reg [2:0] fct_flag;
 
 
        reg [5:0] fct_counter;
        reg [5:0] fct_counter;
        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 block_sum;
 
        reg block_sum_fct_send;
 
 
        reg [3:0] global_counter_transfer;
        reg [3:0] global_counter_transfer;
 
 
 
 
 
 
Line 465... Line 465...
                end
                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@(*)
begin
begin
 
 
        if(!enable_tx)
        fct_send = {3{1'b0}};
 
 
 
        if(send_fct_now)
        begin
        begin
                fct_send <= {3{1'b1}};
                if(block_sum_fct_send)
 
                begin
 
 
        end
        end
        else
        else
        begin
        begin
 
                        if(fct_flag == 3'd7)
                if(fct_send == 3'd7)
 
                begin
                begin
                        fct_send <= 3'd1;
                                fct_send = 3'd0;
                end
                end
                else
                else
                begin
                begin
                        fct_send <= fct_send + 3'd1;
                                fct_send = fct_flag + 3'd1;
 
 
 
                        end
                end
                end
        end
        end
 
 
end
end
 
 
 
 
always@(*)
always@(*)
begin
begin
Line 582... Line 586...
                fct_s         <= 4'h4;
                fct_s         <= 4'h4;
                eop_s         <= 4'h5;
                eop_s         <= 4'h5;
                eep_s         <= 4'h6;
                eep_s         <= 4'h6;
                timecode_s    <= 14'b01110000000000;
                timecode_s    <= 14'b01110000000000;
 
 
                fct_flag      <= 3'd0;
                fct_flag      <= 3'd7;
                fct_send_last <= 3'd0;
 
 
 
                first_time        <= 1'b1;
                first_time        <= 1'b1;
                ready_tx_data     <= 1'b0;
                ready_tx_data     <= 1'b0;
                ready_tx_timecode <= 1'b0;
                ready_tx_timecode <= 1'b0;
 
 
Line 603... Line 606...
                last_timein_control_flag_tx <= 8'd0;
                last_timein_control_flag_tx <= 8'd0;
 
 
                fct_counter_receive <= 6'd0;
                fct_counter_receive <= 6'd0;
 
 
                block_sum  <= 1'b0;
                block_sum  <= 1'b0;
 
                block_sum_fct_send <= 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;
 
 
Line 621... Line 625...
                if(enable_null)
                if(enable_null)
                begin
                begin
 
 
                        ready_tx_data <= 1'b0;
                        ready_tx_data <= 1'b0;
                        ready_tx_timecode <= 1'b0;
                        ready_tx_timecode <= 1'b0;
 
                        //
                        if(gotfct_tx && !block_sum)
                        if(gotfct_tx && !block_sum)
                        begin
                        begin
                                fct_counter_receive <= fct_counter;
                                fct_counter_receive <= fct_counter;
                                block_sum<= 1'b1;
                                block_sum<= 1'b1;
                        end
                        end
Line 633... Line 637...
                        begin
                        begin
                                block_sum<= 1'b0;
                                block_sum<= 1'b0;
                        end
                        end
                        else
                        else
                                block_sum <= block_sum;
                                block_sum <= block_sum;
 
 
                        //
                        //
                        if(fct_send_last != fct_send)
                        if(send_fct_now && !block_sum_fct_send)
                        begin
                        begin
                                if(fct_send == 3'd1 && fct_send_last == 3'd7)
                                fct_flag <= fct_send;
                                begin
                                block_sum_fct_send<= 1'b1;
                                        fct_flag <= fct_flag + 3'd1;
 
                                end
                                end
                                else
                        else if(!send_fct_now)
                                begin
                                begin
                                        fct_flag <= fct_flag + (fct_send - fct_send_last);
                                block_sum_fct_send<= 1'b0;
                                end
 
 
 
                                fct_send_last <= fct_send;
 
                        end
                        end
 
                        else
 
                                block_sum_fct_send <= block_sum_fct_send;
 
 
                        if(first_time)
                        if(first_time)
                        begin
                        begin
                                first_time <= 1'b0;
                                first_time <= 1'b0;
                                hold_null <= 1'b1;
                                hold_null <= 1'b1;
Line 689... Line 690...
 
 
                        if(global_counter_transfer != 4'd3)
                        if(global_counter_transfer != 4'd3)
                        begin
                        begin
                                hold_fct <= 1'b1;
                                hold_fct <= 1'b1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
 
                                //
 
                                if(send_fct_now && !block_sum_fct_send)
 
                                begin
 
                                        fct_flag <= fct_send;
 
                                        block_sum_fct_send<= 1'b1;
 
                                end
 
                                else if(!send_fct_now)
 
                                begin
 
                                        block_sum_fct_send<= 1'b0;
 
                                end
 
                                else
 
                                        block_sum_fct_send <= block_sum_fct_send;
                        end
                        end
                        else
                        else
                        begin
                        begin
                                hold_fct <= 1'b0;
                                hold_fct <= 1'b0;
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
Line 714... Line 727...
                                block_sum<= 1'b0;
                                block_sum<= 1'b0;
                        end
                        end
                        else
                        else
                                block_sum <= block_sum;
                                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;
                        end
                        end
 
 
                        //
                        //
                        if(fct_send_last != fct_send)
                        if(send_fct_now && !block_sum_fct_send)
                        begin
                        begin
                                if(fct_send == 3'd1 && fct_send_last == 3'd7)
                                fct_flag <= fct_send;
                                begin
                                block_sum_fct_send<= 1'b1;
                                        fct_flag <= fct_flag + 3'd1;
 
                                end
                                end
                                else
                        else if(!send_fct_now)
                                begin
                                begin
                                        fct_flag <= fct_flag + (fct_send - fct_send_last);
                                block_sum_fct_send<= 1'b0;
                                end
 
 
 
                                fct_send_last <= fct_send;
 
                        end
                        end
 
                        else
 
                                block_sum_fct_send <= block_sum_fct_send;
 
 
                        if(global_counter_transfer < 4'd13)
                        if(global_counter_transfer < 4'd13)
                        begin
                        begin
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                timecode_s <= {timecode_s[13:10],2'd2,timecode_tx_i[7:0]};
                                timecode_s <= {timecode_s[13:10],2'd2,timecode_tx_i[7:0]};
Line 750... Line 761...
                else if(enable_n_char)
                else if(enable_n_char)
                begin
                begin
 
 
                        ready_tx_timecode <= 1'b0;
                        ready_tx_timecode <= 1'b0;
 
 
                        //if(fct_counter > 6'd0)
 
                        //      fct_counter_receive <= fct_counter;
 
                        //
                        //
                        if(fct_send_last != fct_send)
                        if(send_fct_now && !block_sum_fct_send)
                        begin
 
                                if(fct_send == 3'd1 && fct_send_last == 3'd7)
 
                                begin
                                begin
                                        fct_flag <= fct_flag + 3'd1;
                                fct_flag <= fct_send;
 
                                block_sum_fct_send<= 1'b1;
                                end
                                end
                                else
                        else if(!send_fct_now)
                                begin
                                begin
                                        fct_flag <= fct_flag + (fct_send - fct_send_last);
                                block_sum_fct_send<= 1'b0;
                                end
 
 
 
                                fct_send_last <= fct_send;
 
                        end
                        end
 
                        else
 
                                block_sum_fct_send <= block_sum_fct_send;
 
 
                        if(!data_tx_i[8])
                        if(!data_tx_i[8])
                        begin
                        begin
 
 
                                if(global_counter_transfer == 4'd9)
                                if(global_counter_transfer == 4'd9)

powered by: WebSVN 2.1.0

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