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

Subversion Repositories mac_layer_switch

[/] [mac_layer_switch/] [trunk/] [rtl/] [verilog/] [plu_moduls.v] - Diff between revs 2 and 4

Show entire file | Details | Blame | View Log

Rev 2 Rev 4
Line 374... Line 374...
    input [31:0] Dword;
    input [31:0] Dword;
    input reset ,clk , TxStartFrm , TxEndFrm;
    input reset ,clk , TxStartFrm , TxEndFrm;
    output TxStartFrm_0 , TxEndFrm_1;
    output TxStartFrm_0 , TxEndFrm_1;
   // output TxStartFrm_ , TxEndFrm_;
   // output TxStartFrm_ , TxEndFrm_;
     reg  clk_div2 ,clk_div4 ;
     reg  clk_div2 ,clk_div4 ;
     reg [2:0] mod4;
     reg [1:0] mod4;
     reg [1:0] mod4_;
     reg [1:0] mod4_;
     reg [7:0] byte;
     reg [7:0] byte;
     reg TxStartFrm_ , TxEndFrm_ ,TxStartFrm_1,TxStartFrm_2, start_en , start_en_ ,end_en , start_signal_detect;
     reg TxStartFrm_ , TxEndFrm_ ,TxStartFrm_1,TxStartFrm_2, start_en , start_en_ ,end_en , start_signal_detect;
     reg [9:0] counter;
     reg [9:0] counter;
 
     reg [1:0] FSMState;
     wire   TxStartFrm_0 , TxEndFrm_1;
     wire   TxStartFrm_0 , TxEndFrm_1;
     initial begin
     initial begin
 
        FSMState = 0;
         mod4=0;
         mod4=0;
         mod4_=0;
         mod4_=0;
         counter =0;
         counter =0;
         clk_div2=0;
         clk_div2=0;
         byte=0;
         byte=0;
Line 400... Line 402...
         end
         end
 
 
      always @(posedge TxEndFrm )
      always @(posedge TxEndFrm )
        begin
        begin
            end_en<=1;
            end_en<=1;
            mod4 <=0 ;
       //     mod4 <=0 ;
         end
         end
      always @(posedge TxStartFrm )
      always @(posedge TxStartFrm )
        begin
        begin
           mod4_ <= 0;
           mod4_ <= 0;
           mod4 <= 0;
         //  mod4 <= 0;
           counter=0;
           counter=0;
          // start_en<=1;      //push simultaneously
          // start_en<=1;      //push simultaneously
           //clk_div2=1;
           //clk_div2=1;
         end
         end
 
 
Line 425... Line 427...
      assign TxEndFrm_1 = end_en & (mod4==5);
      assign TxEndFrm_1 = end_en & (mod4==5);
      always @ (posedge clk_div2)
      always @ (posedge clk_div2)
      begin
      begin
           TxEndFrm_<=(mod4==4)?(~clk_div2)&end_en:TxEndFrm;
           TxEndFrm_<=(mod4==4)?(~clk_div2)&end_en:TxEndFrm;
           end_en<= (mod4==5)?0:end_en;
           end_en<= (mod4==5)?0:end_en;
           mod4<=mod4+1;
 
          mod4_<=mod4_+1;
          mod4_<=mod4_+1;
          start_signal_detect = |Dword;
          start_signal_detect = |Dword;
          TxStartFrm_=start_signal_detect & clk_div2;
          TxStartFrm_=start_signal_detect & clk_div2;
          if (start_signal_detect & clk_div2)
          if (start_signal_detect & clk_div2)
              begin
              begin
Line 437... Line 439...
                  end
                  end
                  if (counter >0)
                  if (counter >0)
                      begin
                      begin
                       TxStartFrm_ =0;
                       TxStartFrm_ =0;
                      end
                      end
          case(mod4_)
 
 
 
 
 
 
       end
 
        always @(negedge clk_div2)
 
        begin
 
        case(mod4)
 
 
            2'h0:  byte<= Dword[31:24] ;
            2'h0:  byte<= Dword[31:24] ;
            2'h1:  byte<= Dword[23:16] ;
            2'h1:  byte<= Dword[23:16] ;
            2'h2:  byte<= Dword[15:8] ;
            2'h2:  byte<= Dword[15:8] ;
            2'h3:  byte<= Dword[7:0] ;
            2'h3:  byte<= Dword[7:0] ;
          endcase
          endcase
 
 
       end
       end
 
        always @ (posedge clk_div2)
 
        begin
 
            case (FSMState)
 
            2'b00: begin    // this is non recieving frame state
 
                    if (start_signal_detect == 0)
 
                        begin
 
                        //FSMState <= 2'b00;
 
                        mod4 <= 0;
 
                        end
 
                    else if (start_signal_detect == 1)
 
                        begin
 
                        FSMState <= 2'b11;
 
                        mod4 <= mod4+1;
 
                        end
 
                    end
 
        //    2'b01:  begin
 
         //           if (start_signal_detect == 1)
 
          //              begin
 
           //             FSMState <= 2'b11;
 
           //             mod4 <= 0;
 
           //             end
 
            //        end 
 
            2'b11: begin
 
                    if (start_signal_detect == 1)
 
                        begin
 
                        //FSMState <= 2'b11;
 
                        mod4 <= mod4 +1;
 
                        end
 
                        else if (start_signal_detect==0)
 
                        begin
 
                        FSMState<= 2'b00;
 
                        end
 
                    end
 
            endcase
 
        end
    endmodule
    endmodule
 
 
 
 
module byte_to_Dword(reset,clk ,byte ,Dword , RxStartFrm_ ,RxEndFrm_);
module byte_to_Dword(reset,clk ,byte ,Dword , RxStartFrm_ ,RxEndFrm_);
   input [9:0] byte;
   input [9:0] byte;

powered by: WebSVN 2.1.0

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