FPGA基础以太网

以太网数据通信

物理层:网线+网卡(PHY芯片)
数据链路层:Mac层(数据有效传输)
如图所示:FPGA中的Mac层中的MII接口负责控制PHY芯片,PHY芯片通过网线与PC端进行以太网数据传输。
在这里插入图片描述
FPGA中Mac与PHY通信MII接口
在这里插入图片描述

FPGA通过MAC层发送ARP协议

发送ARP协议目的:知道IP地址后,得到MAC(主机硬件地址)
MAC层模块原理设计图:
在这里插入图片描述
使用MAC层发送ARP命令原理如图所示:
在这里插入图片描述

ARP模块设计

模块设计图

在这里插入图片描述

ARP发送模块设计时序

根据图上的ARP通信原理,设计时序图如下。
在这里插入图片描述

MAC层模块代码
module      mac_mii_send(

input                   [47:0]              mac_source             ,   //Mac_source
input                   [47:0]              mac_goal            ,   //other_Mac
input                                       rst_n               ,
input                                       mac_send_en         ,   //pulse width > 40ns 
input                   [15:0]              data_type           ,   //agreement type
input                   [10:0]              data_length         ,   //main  data field length
input                   [31:0]              crc_result          ,   //Frame check sequence
//      mii Interface                                           
input                                       mii_tx_clk          ,   //mii interface clk
output      reg                             mii_tx_en           ,   //mii interface enable
output      reg         [3:0]               mii_txd             ,   //mii interface data
output                                      mii_tx_error        ,   //error signal high level effective
//          fifo    Interface                                   
input                   [3:0]               mac_send_data       ,   //data read from fifo 
output                                      fifo_rd_clk         ,   //read fifo clock
output                                      data_req            ,   //read request

output      reg                             send_done               //pulse signal = 40ns

);

reg         [5:0]               cnt                     ;
wire                            en_tx_data              ;
reg         [10:0]              data_cnt                ;
reg                             en                      ;


always @(posedge mii_tx_clk or negedge rst_n)
    if(!rst_n)
        en  <=  1'b0;
    else
    if(mac_send_en)
        en  <=  1'b1;
    else
    if(cnt  ==  'h35)                 //'d53
        en  <=  1'b0;

always @(posedge mii_tx_clk or negedge rst_n)
    if(!rst_n)
        cnt <= 1'b0;
    else
    if(en)
        begin
            if(!en_tx_data)
                begin
                    if(cnt  <=  6'h36)                   //'d54
                    cnt <=  cnt +  1'b1;
                    else
                    cnt <=  1'b0;
                end
            else
                cnt <=  cnt ;
        end
    else
        cnt <=  1'b0;

assign      en_tx_data = (cnt == 'h2D)&&(data_cnt < data_length - 1'b1) ;  //'d45   
assign      data_req   = en_tx_data;                         //fifo request signal

always @(posedge mii_tx_clk or negedge rst_n)
    if(!rst_n)
        data_cnt    <= 1'b0;
    else
    if(en_tx_data)
        data_cnt    <= data_cnt  +  1'b1;
    else
    if(data_cnt ==  data_length - 1'b1)
        data_cnt    <=  1'b0;

        
//  mian Sequencer
always @(posedge mii_tx_clk or negedge rst_n)
    if(!rst_n)
        begin
            mii_txd <=  1'b0;
            send_done   <=  1'b0;
        end
    else
        begin
            case(cnt)
                6'h0:   
                    begin
                        mii_txd <=  1'b0;
                        send_done   <=  1'b0;
                    end
                6'h1,6'h2,6'h3,6'h4,6'h5,6'h6,6'h7,6'h8,6'h9,6'ha,6'hb,6'hc,6'hd,6'he,6'hf:
                    mii_txd <=  4'h5;                   //前导码
                6'h10:  
                    mii_txd <=  4'hD;                     //帧开始符
                6'h11:
                    mii_txd <=  mac_goal[43:40] ;           //目的MAC地址
                6'h12:  
                    mii_txd <=  mac_goal[47:44] ;
                6'h13:
                    mii_txd <=  mac_goal[35:32] ;    
                6'h14:  
                    mii_txd <=  mac_goal[39:36] ;
                6'h15:              
                    mii_txd <=  mac_goal[27:24] ;
                6'h16:      
                    mii_txd <=  mac_goal[31:28] ;
                6'h17:  
                    mii_txd <=  mac_goal[19:16] ;      
                6'h18:      
                    mii_txd <=  mac_goal[23:20] ;
                6'h19:
                    mii_txd <=  mac_goal[11:8]  ;    
                6'h1a:  
                    mii_txd <=  mac_goal[15:12] ;
                6'h1b:  
                    mii_txd <=  mac_goal[3:0]   ;
                6'h1c:  
                    mii_txd <=  mac_goal[7:4]   ;
                6'h1d:
                    mii_txd <=  mac_source [43:40] ;      
                6'h1e:                  
                    mii_txd <=  mac_source [47:44] ;            //源MAC地址
                6'h1f:                  
                    mii_txd <=  mac_source [35:32] ;    
                6'h20:                  
                    mii_txd <=  mac_source [39:36] ;
                6'h21:                        
                    mii_txd <=  mac_source [27:24] ;
                6'h22:                  
                    mii_txd <=  mac_source [31:28] ;
                6'h23:                  
                    mii_txd <=  mac_source [19:16] ;
                6'h24:                  
                    mii_txd <=  mac_source [23:20] ;
                6'h25:                 
                    mii_txd <=  mac_source [11:8]  ;
                6'h26:                  
                    mii_txd <=  mac_source [15:12] ;
                6'h27:                  
                    mii_txd <=  mac_source [3:0]   ;
                6'h28:                  
                    mii_txd <=  mac_source [7:4]   ;
                6'h29:                 
                    mii_txd <=  data_type[11:8]  ;                  //长度/类型
                6'h2a:                  
                    mii_txd <=  data_type[15:12] ;
                6'h2b:                  
                    mii_txd <=  data_type[3:0]   ;
                6'h2c:                   
                    mii_txd <=  data_type[7:4]   ;
                6'h2d:                                      //'d45
                    mii_txd <=  mac_send_data    ;
                6'h2e:                                      //'d46
                    mii_txd <=  crc_result [27:24] ;
                6'h2f:                  
                    mii_txd <=  crc_result [31:28] ;
                6'h30:                    
                    mii_txd <=  crc_result [19:16] ;
                6'h31:                    
                    mii_txd <=  crc_result [23:20] ;
                6'h32:                 
                    mii_txd <=  crc_result [11:8]  ;
                6'h33:                    
                    mii_txd <=  crc_result [15:12] ;
                6'h34:                    
                    mii_txd <=  crc_result [3:0]   ;
                6'h35:                    
                    mii_txd <=  crc_result [7:4]   ;
                6'h36:                                  //'d54  
                    begin
                        send_done   <=  1'b1;
                        mii_txd <=  1'b0   ;
                    end
                    
                default: 
                    begin
                        send_done   <=  1'b0;
                        mii_txd <=  1'b0   ;
                    end
            endcase
         
        end

always @(posedge mii_tx_clk or negedge rst_n)
    if(!rst_n)
        mii_tx_en   <=  1'b0;
    else
    if(en && (cnt  ==   'h1))      //'d1
        mii_tx_en   <=  1'b1;
    else  
    if(cnt == 'h36)       //'d54
        mii_tx_en   <=  1'b0;
    else
        mii_tx_en   <=  mii_tx_en   ;

assign      fifo_rd_clk = mii_tx_clk;


endmodule 

使用ARP工具生成Mac层传输的数据(不包含前导码和帧开始符),将数据复制到CRC生成工具,产生CRC校验值。
源主机通过广播形式发出 ARP 请求,以太网帧首部的硬件地址(目的MAC地址)填 FF:FF:FF:FF:FF:FF 表示广播。
在这里插入图片描述

发送ARP请求模块

使用case语句模拟FIFO写入数据。手动计算CRC码。

module      mac_mii_send_test(

input                               rst_n               ,
input                               eth_tx_clk          ,


output                              eth_tx_er           ,
output                              eth_tx_en           ,
output          [3:0]               eth_tx_data         ,         
output                              eth_rst_n           



);

parameter CRC = 32'h79D9D41B;   //h42853ABE   EA1C2E26  (PC IP 192.168.1.1 : h4DB06FEE) (PC IP 192.168.56.1 : hD892D6E1)

wire                                mac_send_en          ;
wire            [31:0]              crc_result           ;
wire                                data_req             ;
wire                                send_done            ;
wire                                fifo_rd_clk          ;
reg             [20:0]              data_cnt             ;
reg             [31:0]              time_cnt             ;
reg             [3:0]               mac_send_data        ;

mac_mii_send        mac_mii_send_inst(

.mac_source         (48'h17_31_81_ca_3c_7a),   //Mac_source
.mac_goal           (48'hff_ff_ff_ff_ff_ff),   //other_Mac  radio
.rst_n              (rst_n),
.mac_send_en        (mac_send_en),   //pulse width > 40ns 
.data_type          (16'h08_06),   //agreement type
.data_length        ('d112),   //main  data field length ARP字段与填充数据  data_length/2个字节
.crc_result         (crc_result),   //Frame check sequence
//      mii Interfac                                           
.mii_tx_clk         (eth_tx_clk),   //mii interface clk
.mii_tx_en          (eth_tx_en),   //mii interface enable
.mii_txd            (eth_tx_data),   //mii interface data
.mii_tx_error       (),   //error signal high level effective
//          fifo    Interface                                    fifo 设置为 showahead 模式
.mac_send_data      (mac_send_data),   //data read from fifo 
.fifo_rd_clk        (fifo_rd_clk),   //read fifo clock
.data_req           (data_req),   //read request

.send_done          (send_done)    //pulse signal = 40ns

);

assign      eth_rst_n       =       1;
assign crc_result = {CRC[7:0],CRC[15:8],CRC[23:16],CRC[31:24]};


always @(posedge eth_tx_clk or negedge rst_n)
    if(!rst_n)
        data_cnt    <=  1'b0;
    else
    if(data_req)
        data_cnt    <=  data_cnt  + 1'b1;
    else
        data_cnt    <=  1'b0;

always @(posedge eth_tx_clk or negedge rst_n)
    if(!rst_n)
        time_cnt <=  'd0;
    else
    if(time_cnt == 'd80000)     // 
        time_cnt    <=  1'b0;
    else
        time_cnt   <=   time_cnt    + 1'b1;

assign  mac_send_en = (time_cnt == 'd50);   //d2_499_999

always @(*)      //ARP字段与填充数据
    begin
        case(data_cnt)
            0, 1, 3  :   mac_send_data    =   4'h0;
            2   :   mac_send_data    =   4'h1; 
            
            4   :   mac_send_data    =   4'h8;
            5   :   mac_send_data    =   4'h0;
            6   :   mac_send_data    =   4'h0;          
            7   :   mac_send_data    =   4'h0;   
            
            8   :   mac_send_data    =   4'h6; //MAC地址长度
            9   :   mac_send_data    =   4'h0;   
           10   :   mac_send_data    =   4'h4;  //IP地址长度
           11   :   mac_send_data    =   4'h0;   
           
           12   :   mac_send_data    =   4'h0;      //操作码  请求包
           13   :   mac_send_data    =   4'h0;
           14   :   mac_send_data    =   4'h1;
           15   :   mac_send_data    =   4'h0;
           
           16   :   mac_send_data    =   4'h7;   //源MAC地址
           17   :   mac_send_data    =   4'h1;
           18   :   mac_send_data    =   4'h1;
           19   :   mac_send_data    =   4'h3;
           20   :   mac_send_data    =   4'h1;
           21   :   mac_send_data    =   4'h8;
           22   :   mac_send_data    =   4'ha;
           23   :   mac_send_data    =   4'hc;
           24   :   mac_send_data    =   4'hc;
           25   :   mac_send_data    =   4'h3;
           26   :   mac_send_data    =   4'ha;
           27   :   mac_send_data    =   4'h7;          
           
           28   :   mac_send_data    =   4'h0;   //源IP地址   192.168.1.201
           29   :   mac_send_data    =   4'hc;
           30   :   mac_send_data    =   4'h8;
           31   :   mac_send_data    =   4'ha;
           32   :   mac_send_data    =   4'h1;
           33   :   mac_send_data    =   4'h0;
           34   :   mac_send_data    =   4'h9;
           35   :   mac_send_data    =   4'hc;
           
           36   :   mac_send_data    =   4'h0;   //目标MAC地址     
           37   :   mac_send_data    =   4'h0;
           38   :   mac_send_data    =   4'h0;
           39   :   mac_send_data    =   4'h0;
           40   :   mac_send_data    =   4'h0;
           41   :   mac_send_data    =   4'h0;
           42   :   mac_send_data    =   4'h0;
           43   :   mac_send_data    =   4'h0;
           44   :   mac_send_data    =   4'h0;
           45   :   mac_send_data    =   4'h0;
           46   :   mac_send_data    =   4'h0;
           47   :   mac_send_data    =   4'h0; 
           
           48   :   mac_send_data    =   4'h0;   //目标IP   192.168.1.4   
           49   :   mac_send_data    =   4'hc;
           50   :   mac_send_data    =   4'h8;
           51   :   mac_send_data    =   4'ha;
           52   :   mac_send_data    =   4'h1;             // 
           53   :   mac_send_data    =   4'h0;             //
           54   :   mac_send_data    =   4'h4;             //
           55   :   mac_send_data    =   4'h0;             //
           
           56   :   mac_send_data    =   4'h0; //填充
           57   :   mac_send_data    =   4'h0; 
           58   :   mac_send_data    =   4'h0; 
           59   :   mac_send_data    =   4'h0; 
           60   :   mac_send_data    =   4'hf; 
           61   :   mac_send_data    =   4'hf; 
           62   :   mac_send_data    =   4'hf; 
           63   :   mac_send_data    =   4'hf; 
           64   :   mac_send_data    =   4'hf; 
           65   :   mac_send_data    =   4'hf; 
           66   :   mac_send_data    =   4'hf; 
           67   :   mac_send_data    =   4'hf; 
           68   :   mac_send_data    =   4'hf; 
           69   :   mac_send_data    =   4'hf; 
           70   :   mac_send_data    =   4'hf; 
           71   :   mac_send_data    =   4'hf; 
           72   :   mac_send_data    =   4'h0; 
           73   :   mac_send_data    =   4'h0; 
           74   :   mac_send_data    =   4'h3; 
           75   :   mac_send_data    =   4'h2; 
           76   :   mac_send_data    =   4'hd; 
           77   :   mac_send_data    =   4'hc; 
           78   :   mac_send_data    =   4'h6; 
           79   :   mac_send_data    =   4'h7; 
           80   :   mac_send_data    =   4'h3; 
           81   :   mac_send_data    =   4'h6; 
           82   :   mac_send_data    =   4'ha; 
           83   :   mac_send_data    =   4'h1; 
           84   :   mac_send_data    =   4'h8; 
           85   :   mac_send_data    =   4'h0; 
           86   :   mac_send_data    =   4'h6; 
           87   :   mac_send_data    =   4'h0; 
           88   :   mac_send_data    =   4'h0; 
           89   :   mac_send_data    =   4'h0; 
           90   :   mac_send_data    =   4'h1; 
           91   :   mac_send_data    =   4'h0; 
           92   :   mac_send_data    =   4'h3;
           93   :   mac_send_data    =   4'h7;

           94   :   mac_send_data    =   4'h4;
           95   :   mac_send_data    =   4'h7;
           96   :   mac_send_data    =   4'h5;
           97   :   mac_send_data    =   4'h7;
           98   :   mac_send_data    =   4'h6;
           99   :   mac_send_data    =   4'h7;  
          100   :   mac_send_data    =   4'h7;
          101   :   mac_send_data    =   4'h7;
          102   :   mac_send_data    =   4'h1;
          103   :   mac_send_data    =   4'h6;
          104   :   mac_send_data    =   4'h2;
          105   :   mac_send_data    =   4'h6;
          106   :   mac_send_data    =   4'h3;
          107   :   mac_send_data    =   4'h6;
          108   :   mac_send_data    =   4'h4;
          109   :   mac_send_data    =   4'h6;
          110   :   mac_send_data    =   4'h5;
          111   :   mac_send_data    =   4'h6;
     
           default :  mac_send_data    =   4'h0;
        
        endcase

    end

endmodule 

使用Wireshark软件查看ARP字段与应答。
在这里插入图片描述

FPGA通过MAC层发送UDP协议

IP报头检验和计算模块

将IP报头以2字节为单位相加(此时IP报头检验和为零),求和结果将数据高位溢出位加低16位,求和结果取反为IP报头检验和。

module ip_check(
  
input						[3:0]		edition						,	//版本				
input 						[3:0]		head_length					,	//首部长度
input 						[7:0]		service_type				,	//服务类型
input 						[15:0]		ip_message_length			,	//ip报文长度
input 						[30:0]		block_logo					,	//分段标识 + 偏移
input 						[7:0]		life_cycle					,	//生存周期
input						[7:0]		agreement_type				,	//上层协议类型
// input						[15:0]		ip_checkout_0			,		//计算时IP报头检验和为零							
input						[31:0]		source_ip_address			,	//源IP地址
input						[31:0]		goal_ip_address				,	//目的IP地址

output 						[15:0]		ip_checkout						//IP报头检验和 

);

wire						[31:0]		ip_check_sum				;
wire						[31:0]		ip_check_sum_reg			;

assign 	ip_check_sum_reg = ({edition,head_length,service_type} + ip_message_length + block_logo + {life_cycle,agreement_type} + source_ip_address[31:16] + source_ip_address[15:0] + goal_ip_address[31:16] + goal_ip_address[15:0]);

assign ip_check_sum = ~(ip_check_sum_reg[31:16] + ip_check_sum_reg[15:0]);


assign ip_checkout = ip_check_sum;


endmodule 

发送DUP顶层模块
module      mac_udp_send_test(

input                               rst_n               ,
input                               eth_tx_clk          ,


output                              eth_tx_er           ,
output                              eth_tx_en           ,
output          [3:0]               eth_tx_data         ,         
output                              eth_rst_n           



);

parameter CRC = 32'hFE3A3426;   //h42853ABE   EA1C2E26  (PC IP 192.168.1.1 : h4DB06FEE) (PC IP 192.168.56.1 : hD892D6E1)
parameter DATA_LENFTH = 11'd92;     //46字节

wire                                mac_send_en          	;
wire            [31:0]              crc_result           	;
wire                                data_req             	;
wire                                send_done            	;
wire                                fifo_rd_clk          	;
reg             [20:0]              data_cnt             	;
reg             [31:0]              time_cnt             	;
reg             [3:0]               mac_send_data        	;
wire								crc_en				 	;
wire			[31:0]				crc					 	;
wire			[15:0]				ip_checkout				;


assign      eth_rst_n       =       1;
assign crc_result = {CRC[7:0],CRC[15:8],CRC[23:16],CRC[31:24]};
// assign	crc_result = CRC ;

mac_udp_send        mac_udp_send_inst(

.mac_source         (48'h17_31_81_CA_3C_7A),   //Mac_source
.mac_goal           (48'h58_11_22_A0_E9_61),   //目的MAC地址
.rst_n              (rst_n),
.mac_send_en        (mac_send_en),   //pulse width > 40ns 
.data_type          (16'h08_00),   // 长度/类型 UDP
.data_length        (DATA_LENFTH),   // 数据与填充  data_length/2个字节
.crc_result         (crc_result),   //Frame check sequence
//      mii Interfac                                           
.mii_tx_clk         (eth_tx_clk),   //mii interface clk
.mii_tx_en          (eth_tx_en),   //mii interface enable
.mii_txd            (eth_tx_data),   //mii interface data
.mii_tx_error       (),   	     //error signal high level effective
//          fifo    Interface                                    fifo 设置为 showahead 模式
.mac_send_data      (mac_send_data),   //data read from fifo  input
.fifo_rd_clk        (fifo_rd_clk),   //read fifo clock
.data_req           (data_req),   //read request
.crc_en				(crc_en),		

.send_done          (send_done)    //pulse signal = 40ns

);


ip_check	ip_check_inst(

	.edition			(4'h4)			,	//版本				
	.head_length		(4'h5)			,	//首部长度
	.service_type		(0)				,	//服务类型
	.ip_message_length	(16'h002E)		,	//ip报文长度
	.block_logo			(0)				,	//分段标识等
	.life_cycle			(8'h40)			,	//生存周期
	.agreement_type		('d17)			,	//上层协议类型					
	.source_ip_address	('hC0_A8_01_C9)	,	//源IP地址
	.goal_ip_address	('hC0_A8_01_04)	,	//目的IP地址
	
	.ip_checkout		(ip_checkout)				//IP报头检验和 
);




always @(posedge eth_tx_clk or negedge rst_n)
    if(!rst_n)
        data_cnt    <=  1'b0;
    else
    if(data_req)
        data_cnt    <=  data_cnt  + 1'b1;
    else
        data_cnt    <=  1'b0;

always @(posedge eth_tx_clk or negedge rst_n)
    if(!rst_n)
        time_cnt <=  'd0;
    else
    if(time_cnt == 'd80000)     // 
        time_cnt    <=  1'b0;
    else
        time_cnt   <=   time_cnt    + 1'b1;

assign  mac_send_en = (time_cnt == 'd50);   //d2_499_999

always @(*)      //ARP字段与填充数据
    begin
        case(data_cnt)
            0   :   mac_send_data    =   4'h5;	   	//IP首部长度
			1	: 	mac_send_data    =   4'h4;		//IPV4
			
            2   :   mac_send_data    =   4'h0;		//服务类型
			3	:	mac_send_data    =   4'h0;	
            
            4   :   mac_send_data    =   4'h0;		//IP报文长度  
            5   :   mac_send_data    =   4'h0;
            6   :   mac_send_data    =   4'he;          
            7   :   mac_send_data    =   4'h2;   
            
            8   :   mac_send_data    =   4'h0;		//分段表示 设置0 
            9   :   mac_send_data    =   4'h0;   
           10   :   mac_send_data    =   4'h0;  
           11   :   mac_send_data    =   4'h0;   
           12   :   mac_send_data    =   4'h0;     
           13   :   mac_send_data    =   4'h0;
           14   :   mac_send_data    =   4'h0;
           15   :   mac_send_data    =   4'h0;
           
           16   :   mac_send_data    =   4'h0;   	//周期    64
           17   :   mac_send_data    =   4'h4;
		   
           18   :   mac_send_data    =   4'h1;		//上层协议类型
           19   :   mac_send_data    =   4'h1;
					//  算
           20   :   mac_send_data    =   ip_checkout[11:8];		//IP报头检验和 逻辑模块算出  忽略		ip_checkout[11:8]
		   21   :   mac_send_data    =   ip_checkout[15:12];		//IP版本+....+目的IP地址			ip_checkout[15:12]
           22   :   mac_send_data    =   ip_checkout[3:0];		//测试校验和 图7.5-11					ip_checkout[3:0]
           23   :   mac_send_data    =   ip_checkout[7:4];											  //ip_checkout[7:4]
		   
           24   :   mac_send_data    =   4'h0;		//源IP地址	192.168.1.201
           25   :   mac_send_data    =   4'hc;
           26   :   mac_send_data    =   4'h8;
           27   :   mac_send_data    =   4'ha;		   
           28   :   mac_send_data    =   4'h1;   
           29   :   mac_send_data    =   4'h0;
           30   :   mac_send_data    =   4'h9;
           31   :   mac_send_data    =   4'hc;
		   
           32   :   mac_send_data    =   4'h0;		//目的IP地址 4字节 192.168.1.4
           33   :   mac_send_data    =   4'hc;
           34   :   mac_send_data    =   4'h8;
           35   :   mac_send_data    =   4'ha;
           36   :   mac_send_data    =   4'h1;      
           37   :   mac_send_data    =   4'h0;
           38   :   mac_send_data    =   4'h4;
           39   :   mac_send_data    =   4'h0;
		   //UDP协议层
           40   :   mac_send_data    =   4'h9;		//源端口号 2字节  6500
           41   :   mac_send_data    =   4'h1;
           42   :   mac_send_data    =   4'h4;
           43   :   mac_send_data    =   4'h6;
		   
           44   :   mac_send_data    =   4'h5;       //目的端口号 2字节 5500
           45   :   mac_send_data    =   4'h1;
           46   :   mac_send_data    =   4'hc;
           47   :   mac_send_data    =   4'h7; 
           
           48   :   mac_send_data    =   4'h0;   	//UDP报文长度  26  2字节 
           49   :   mac_send_data    =   4'h0;
           50   :   mac_send_data    =   4'ha;
           51   :   mac_send_data    =   4'h1;
		   
           52   :   mac_send_data    =   4'h0;             // UDP校验和  2字节  忽略全零
           53   :   mac_send_data    =   4'h0;            
           54   :   mac_send_data    =   4'h0;            
           55   :   mac_send_data    =   4'h0;            
           
           56   :   mac_send_data    =   4'h8; //填充和数据
           57   :   mac_send_data    =   4'h4; 
           58   :   mac_send_data    =   4'h5; 
           59   :   mac_send_data    =   4'h6; 
           60   :   mac_send_data    =   4'hc; 
           61   :   mac_send_data    =   4'h6; 
           62   :   mac_send_data    =   4'hc; 
           63   :   mac_send_data    =   4'h6; 
           64   :   mac_send_data    =   4'hf; 
           65   :   mac_send_data    =   4'h6; 
           66   :   mac_send_data    =   4'hc; 
           67   :   mac_send_data    =   4'h2; 
           68   :   mac_send_data    =   4'h7; 
           69   :   mac_send_data    =   4'h6; 
           70   :   mac_send_data    =   4'hf; 
           71   :   mac_send_data    =   4'h6; 
           72   :   mac_send_data    =   4'hf; 
           73   :   mac_send_data    =   4'h6; 
           74   :   mac_send_data    =   4'h4; 
           75   :   mac_send_data    =   4'h6; 
           76   :   mac_send_data    =   4'h0; 
           77   :   mac_send_data    =   4'h2; 
           78   :   mac_send_data    =   4'h4; 
           79   :   mac_send_data    =   4'h7; 
           80   :   mac_send_data    =   4'hf; 
           81   :   mac_send_data    =   4'h6; 
           82   :   mac_send_data    =   4'h0; 
           83   :   mac_send_data    =   4'h2; 
           84   :   mac_send_data    =   4'h6; 
           85   :   mac_send_data    =   4'h4; 
           86   :   mac_send_data    =   4'h0; 
           87   :   mac_send_data    =   4'h5; 
           88   :   mac_send_data    =   4'h7; 
           89   :   mac_send_data    =   4'h4; 
           90   :   mac_send_data    =   4'h1; 
           91   :   mac_send_data    =   4'h4;
		   
           default :  mac_send_data    =   4'h0;
        
        endcase

    end

endmodule 

可以看到IP校验和无误,并且成功发送字母。
在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/159763.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【草料】uni-app ts vue 小程序 如何如何通过草料生成对应的模块化二维码

一、查看uni-app项目 1、找到路径 可以看到项目从 src-race-pages-group 这个使我们目标的查询页面 下面我们将这个路径copy到草料内 2、找到进入页面入参 一般我们都会选择 onload() 函数下的入参 这里我们参数的是 id 二、草料 建议看完这里的教程文档 十分清晰&#xff01…

学习笔记6——垃圾回收

学习笔记系列开头惯例发布一些寻亲消息 链接&#xff1a;https://baobeihuijia.com/bbhj/contents/3/190801.html java垃圾回收&#xff08;stop the world&#xff09; 专注于堆和方法区的垃圾回收&#xff0c;年轻代&#xff0c;老年代&#xff0c;永久代判断对象是否还存…

基于flask和fomantic-ui的简易p2p文件分享平台的手动实现

背景 开学一个多月了&#xff0c;由于繁重的学业和懒惰&#xff0c;都没怎么更新有意思的博客。 前几天突然想到了一个想法。同学之间平常用网络分享一个文件&#xff0c;大部分都是用的qq。但是qq看起来把文件拖到聊天框点击发送就发给对面同学了。但是实际上是先上传到了腾…

【C语言期末不挂科——指针篇1】

C语言指针初阶 文章目录 C语言指针初阶**什么是指针&#xff1f;**   **1&#xff09;初识指针**  **2&#xff09;地址的大小**  **3&#xff09;指针变量** **指针的类型**   **1)指针对整数加减运算**  **2&#xff09;指针的解引用** **野指针**  **1&#xff…

河北大学选择ZStack Cube超融合一体机打造实训云平台

河北大学通过云轴科技ZStack Cube超融合一体机构建校园实训云平台&#xff0c;部署测试仅耗时1天&#xff0c;该平台能够更快地为学生提供高性能、高可用的云主机、云存储和云网络服务&#xff1b;同时也能满足日常运维管理要求&#xff0c;为学生提供更好的实训环境。 河北省…

什么是NoSQL?什么是redis?redis是做什么的?

redis官网 NoSQL泛指非关系型数据库&#xff0c;redis是其中的一种&#xff0c;Redis是发展最快的。 什么是NoSQL&#xff1f; NoSQL是一个广义的术语&#xff0c;指的是非关系型数据库&#xff0c;不同于传统的关系型数据库&#xff08;如MySQL、Oracle等&#xff09;。它没有…

(二)Pytorch快速搭建神经网络模型实现气温预测回归(代码+详细注解)

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 前言一、数据集二、导入数据以及展示部分1.导入数据集以及对数据集进行处理2.展示数据&#xff08;看看就好&#xff09; 三&#xff08;1&#xff09;、搭建网络进…

Diagrams——制作短小精悍的流程图

今天为大家分享的是一款轻量级的流程图绘制软件——Diagrams。 以特定的图形符号加上说明&#xff0c;表示算法的图&#xff0c;称为流程图或框图。流程图是流经一个系统的信息流、观点流或部件流的图形代表。我们常用流程图来说明某一过程。 流程图使用一些标准符号代表某些类…

计算数组中每个元素的立方根numpy.cbrt()

【小白从小学Python、C、Java】 【计算机等级考试500强双证书】 【Python-数据分析】 计算数组中每个元素的立方根 numpy.cbrt() [太阳]选择题 请问以下代码中执行语句输出结果是&#xff1f; import numpy as np a np.array([1, 8, 27]) print("【显示】a ",a) pr…

二维码智慧门牌管理系统升级,异常门牌聚合解决方案助力高效管理

文章目录 前言一、异常门牌聚合解决方案 前言 在今天的数字化时代&#xff0c;智慧城市已成为发展趋势&#xff0c;其中二维码智慧门牌管理系统扮演着至关重要的角色。通过对门牌信息进行数字化管理&#xff0c;该系统极大提升了城市管理的效率和便捷性。然而&#xff0c;随着…

QMenuBar和QToolBar使用同一个QAction

文章目录 前言一、编辑QMenuBar二、将QMenuBar中的Action添加到toolbar总结 前言 qmenubar中的action添加到toolbar&#xff0c;不是在toolbar中再添加action&#xff0c;效果图如下 一、编辑QMenuBar 正常编辑QMenuBar&#xff0c;以下图为例 二、将QMenuBar中的Action添…

logistic回归后快速绘制亚组森林图!SCI发表级高清图片分分钟生成!

本周为大家重点介绍一下风暴统计平台的最新板块——亚组森林图&#xff01; 现在亚组分析好像越来越流行&#xff0c;无论是观察性研究还是RCT研究&#xff0c;亚组分析一般配备森林图。 比如这张图&#xff1a; 还有这个&#xff1a; 森林图不仅是画图的画法&#xff0c;背后还…

算法 LeetCode 题解 | 有效的括号

大家好&#xff0c;我是木川 一、题目描述 给定一个只包括 (&#xff0c;)&#xff0c;{&#xff0c;}&#xff0c;[&#xff0c;] 的字符串 s &#xff0c;判断字符串是否有效。 有效字符串需满足&#xff1a; 左括号必须用相同类型的右括号闭合。左括号必须以正确的顺序闭合。…

Java源码分析:Guava之不可变集合ImmutableMap的源码分析

原创/朱季谦 一、案例场景 遇到过这样的场景&#xff0c;在定义一个static修饰的Map时&#xff0c;使用了大量的put()方法赋值&#xff0c;就类似这样—— public static final Map<String,String> dayMap new HashMap<>(); static {dayMap.put("Monday&q…

Apache Airflow (十) :SSHOperator及调度远程Shell脚本

&#x1f3e1; 个人主页&#xff1a;IT贫道_大数据OLAP体系技术栈,Apache Doris,Clickhouse 技术-CSDN博客 &#x1f6a9; 私聊博主&#xff1a;加入大数据技术讨论群聊&#xff0c;获取更多大数据资料。 &#x1f514; 博主个人B栈地址&#xff1a;豹哥教你大数据的个人空间-豹…

【计算机网络笔记】ICMP(互联网控制报文协议)

系列文章目录 什么是计算机网络&#xff1f; 什么是网络协议&#xff1f; 计算机网络的结构 数据交换之电路交换 数据交换之报文交换和分组交换 分组交换 vs 电路交换 计算机网络性能&#xff08;1&#xff09;——速率、带宽、延迟 计算机网络性能&#xff08;2&#xff09;…

农户建档管理系统的设计与实现-计算机毕业设计源码20835

摘 要 随着互联网趋势的到来&#xff0c;各行各业都在考虑利用互联网将自己推广出去&#xff0c;最好方式就是建立自己的互联网系统&#xff0c;并对其进行维护和管理。在现实运用中&#xff0c;应用软件的工作规则和开发步骤&#xff0c;采用Java技术建设农户建档管理系统。 本…

项目技术复盘

背景 该项目接手时已是8月中下旬&#xff0c;并且客户要求九月中旬输出第一版本。这么紧急的节奏&#xff0c;不知道商务是如何答应的。临危受命&#xff0c;让我承担开发经理岗位&#xff0c;主导该项目。 开发团队 岗位 人员 base 架构师兼高级软件工程师 季工 上海 高…

Java中利用OpenCV进行人脸识别

OpenCV 概述 ​ OpenCV&#xff08;Open Source Computer Vision Library&#xff09;是一个开源计算机视觉库&#xff0c;它提供了丰富的工具和算法&#xff0c;用于处理图像和视频数据。该库由一系列高效的计算机视觉算法组成&#xff0c;涵盖了许多领域&#xff0c;包括目…

C++单调向量算法:132 模式解法三枚举1

本题不同解法 包括题目及代码C二分查找算法&#xff1a;132 模式解法一枚举3C二分查找算法&#xff1a;132 模式解法二枚举2代码最简洁C二分查找算法&#xff1a;132 模式解法三枚举1性能最佳C单调向量算法&#xff1a;132 模式解法三枚举1 分析 时间复杂度 2轮循环时间复杂…