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

Subversion Repositories spacewiresystemc

[/] [spacewiresystemc/] [trunk/] [rtl/] [RTL_VB/] [tx_spw.v] - Diff between revs 23 and 25

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

Rev 23 Rev 25
Line 68... Line 68...
                 EOP      = 6'b000100,
                 EOP      = 6'b000100,
                 EEP      = 6'b001000,
                 EEP      = 6'b001000,
                 DATA     = 6'b010000,
                 DATA     = 6'b010000,
                 TIMEC    = 6'b100000;
                 TIMEC    = 6'b100000;
 
 
 
 
 
localparam [7:0] null_s = 8'b01110100;
 
localparam [2:0] fct_s  = 3'b100;
 
localparam [3:0] eop_s  = 4'b0101;
 
localparam [3:0] eep_s  = 4'b0110;
 
localparam [13:0] timecode_ss    = 14'b01110000000000;
 
 
 
 
 
 
        reg [2:0] state_tx;
        reg [2:0] state_tx;
        reg [2:0] next_state_tx;
        reg [2:0] next_state_tx;
 
 
        reg [7:0]  null_s;
        //reg [7:0]  null_s;
        reg [3:0]  fct_s;
        //reg [2:0]  fct_s;
        reg [3:0]  eop_s;
        //reg [3:0]  eop_s;
        reg [3:0]  eep_s;
        //reg [3:0]  eep_s;
        reg [13:0] timecode_s;
        reg [13:0] timecode_s;
 
 
        reg [5:0]  last_type;
        reg [5:0]  last_type;
        reg [8:0]  txdata_flagctrl_tx_last;
        reg [8:0]  txdata_flagctrl_tx_last;
        reg [7:0]  last_timein_control_flag_tx;
        reg [7:0]  last_timein_control_flag_tx;
Line 576... Line 585...
        end
        end
        endcase
        endcase
 
 
end
end
 
 
always@(posedge pclk_tx)
always@(posedge pclk_tx or negedge enable_tx)
begin
begin
        if(!enable_tx)
        if(!enable_tx)
        begin
        begin
                null_s        <= 8'b01110100;
 
                fct_s         <= 4'b0100;
 
                eop_s         <= 4'b0101;
 
                eep_s         <= 4'b0110;
 
                timecode_s    <= 14'b01110000000000;
 
 
 
 
                timecode_s    <= 14'b01110000000000;
                fct_flag      <= 3'd7;
                fct_flag      <= 3'd7;
 
 
                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 616... Line 621...
 
 
        end
        end
        else
        else
        begin
        begin
 
 
 
                //null_s        <= null_s;
 
                //fct_s         <= fct_s;
 
                //eop_s         <= eop_s;
 
                //eep_s         <= eep_s;
 
                //timecode_s    <= timecode_s;  
 
                //fct_flag      <= fct_flag;
 
 
                state_tx <= next_state_tx;
                state_tx <= next_state_tx;
                last_tx_dout <= tx_dout;
                last_tx_dout <= tx_dout;
                last_tx_sout <= tx_sout;
                last_tx_sout <= tx_sout;
 
 
                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;
 
                        //hold_null     <= 1'b0;
 
                        hold_fct        <= 1'b0;
 
                        hold_data       <= 1'b0;
 
                        hold_time_code  <= 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;
Line 664... Line 681...
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                                global_counter_transfer <= global_counter_transfer + 4'd1;
                        end
                        end
                        else
                        else
                        begin
                        begin
                                hold_null <= 1'b0;
                                hold_null <= 1'b0;
 
                                last_type  <= NULL;
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
                        end
                        end
                end
                end
                else if(enable_fct)
                else if(enable_fct)
                begin
                begin
 
 
                        ready_tx_data <= 1'b0;
                        ready_tx_data <= 1'b0;
                        ready_tx_timecode <= 1'b0;
                        ready_tx_timecode <= 1'b0;
 
 
 
                        hold_null       <= 1'b0;
 
                        //hold_fct      <= 1'b0;
 
                        hold_data       <= 1'b0;
 
                        hold_time_code  <= 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 708... Line 732...
                        else
                        else
                        begin
                        begin
                                hold_fct <= 1'b0;
                                hold_fct <= 1'b0;
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
                                fct_flag <= fct_flag - 3'd1;
                                fct_flag <= fct_flag - 3'd1;
 
                                last_type  <=FCT;
                        end
                        end
                end
                end
                else if(enable_time_code)
                else if(enable_time_code)
                begin
                begin
 
                        hold_null       <= 1'b0;
 
                        hold_fct        <= 1'b0;
 
                        hold_data       <= 1'b0;
 
                        //hold_time_code        <= 1'b0;
 
 
                        ready_tx_data <= 1'b0;
                        ready_tx_data <= 1'b0;
 
 
                        if(gotfct_tx && !block_sum)
                        if(gotfct_tx && !block_sum)
                        begin
                        begin
Line 748... Line 777...
                                block_sum_fct_send <= block_sum_fct_send;
                                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_ss[13:10],2'd2,timecode_tx_i[7:0]};
                        end
                        end
                        else
                        else
                        begin
                        begin
                                last_timein_control_flag_tx <= timecode_tx_i;
                                last_timein_control_flag_tx <= timecode_tx_i;
                                global_counter_transfer <= 4'd0;
                                global_counter_transfer <= 4'd0;
 
                                last_type  <= TIMEC;
                        end
                        end
                end
                end
                else if(enable_n_char)
                else if(enable_n_char)
                begin
                begin
 
 
                        ready_tx_timecode <= 1'b0;
                        ready_tx_timecode <= 1'b0;
 
                        hold_null       <= 1'b0;
 
                        hold_fct        <= 1'b0;
 
                        //hold_data     <= 1'b0;
 
                        hold_time_code  <= 1'b0;
 
 
                        //
                        //
                        if(send_fct_now && !block_sum_fct_send)
                        if(send_fct_now && !block_sum_fct_send)
                        begin
                        begin
                                fct_flag <= fct_send;
                                fct_flag <= fct_send;
Line 809... Line 843...
                                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;
 
                                        last_type  <= DATA;
                                end
                                end
 
 
                        end
                        end
                        else if(data_tx_i[8])
                        else if(data_tx_i[8])
                        begin
                        begin
Line 848... Line 883...
                                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;
 
                                        last_type  <=EOP;
                                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.