eth 在线生成 input data

访问网址

https://abi.hashex.org/#

例如

https://etherscan.io/tx/0xea64139cee19d0d1222ce0ccd4ddbc8d64d65e725262f0e4b21d01c98639d868

#NameTypeData
0_toaddress8e7e315fd8965b0fadc7c404307a55d5a6ccf155
1_valueuint2561366240200000000000

abi.json

[
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "name",
        "outputs": [
            {
                "name": "",
                "type": "string"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "golemFactory",
        "outputs": [
            {
                "name": "",
                "type": "address"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "totalSupply",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": false,
        "inputs": [
            {
                "name": "_master",
                "type": "address"
            }
        ],
        "name": "setMigrationMaster",
        "outputs": [
            
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "decimals",
        "outputs": [
            {
                "name": "",
                "type": "uint8"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": false,
        "inputs": [
            {
                "name": "_value",
                "type": "uint256"
            }
        ],
        "name": "migrate",
        "outputs": [
            
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": false,
        "inputs": [
            
        ],
        "name": "finalize",
        "outputs": [
            
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": false,
        "inputs": [
            
        ],
        "name": "refund",
        "outputs": [
            
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "migrationMaster",
        "outputs": [
            {
                "name": "",
                "type": "address"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "tokenCreationCap",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            {
                "name": "_owner",
                "type": "address"
            }
        ],
        "name": "balanceOf",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": false,
        "inputs": [
            {
                "name": "_agent",
                "type": "address"
            }
        ],
        "name": "setMigrationAgent",
        "outputs": [
            
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "migrationAgent",
        "outputs": [
            {
                "name": "",
                "type": "address"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "fundingEndBlock",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "totalMigrated",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "symbol",
        "outputs": [
            {
                "name": "",
                "type": "string"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": false,
        "inputs": [
            {
                "name": "_to",
                "type": "address"
            },
            {
                "name": "_value",
                "type": "uint256"
            }
        ],
        "name": "transfer",
        "outputs": [
            {
                "name": "",
                "type": "bool"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "tokenCreationMin",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "funding",
        "outputs": [
            {
                "name": "",
                "type": "bool"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "tokenCreationRate",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": true,
        "inputs": [
            
        ],
        "name": "fundingStartBlock",
        "outputs": [
            {
                "name": "",
                "type": "uint256"
            }
        ],
        "payable": false,
        "type": "function"
    },
    {
        "constant": false,
        "inputs": [
            
        ],
        "name": "create",
        "outputs": [
            
        ],
        "payable": true,
        "type": "function"
    },
    {
        "inputs": [
            {
                "name": "_golemFactory",
                "type": "address"
            },
            {
                "name": "_migrationMaster",
                "type": "address"
            },
            {
                "name": "_fundingStartBlock",
                "type": "uint256"
            },
            {
                "name": "_fundingEndBlock",
                "type": "uint256"
            }
        ],
        "type": "constructor"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": true,
                "name": "_from",
                "type": "address"
            },
            {
                "indexed": true,
                "name": "_to",
                "type": "address"
            },
            {
                "indexed": false,
                "name": "_value",
                "type": "uint256"
            }
        ],
        "name": "Transfer",
        "type": "event"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": true,
                "name": "_from",
                "type": "address"
            },
            {
                "indexed": true,
                "name": "_to",
                "type": "address"
            },
            {
                "indexed": false,
                "name": "_value",
                "type": "uint256"
            }
        ],
        "name": "Migrate",
        "type": "event"
    },
    {
        "anonymous": false,
        "inputs": [
            {
                "indexed": true,
                "name": "_from",
                "type": "address"
            },
            {
                "indexed": false,
                "name": "_value",
                "type": "uint256"
            }
        ],
        "name": "Refund",
        "type": "event"
    }
]

https://download.mycrypto.com/

下载钱包

选择网络

通过私钥导入解锁钱包

 

 

 

 

如上图

0xa9059cbb0000000000000000000000008e7e315fd8965b0fadc7c404307a55d5a6ccf15500000000000000000000000000000000000000000000000012f5dc3926dbd000

 

相等

大功告成!

`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2025/07/07 13:01:03 // Design Name: // Module Name: arp_tx // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Revision: // Revision 0.01 - File Created // Additional Comments: // ////////////////////////////////////////////////////////////////////////////////// module arp_tx( input clk , //时钟信号 input rst_n , //复位信号,低电平有效 input arp_tx_en , //ARP发送使能信号 input arp_tx_type, //ARP发送类型 0:请求 1:应答 input [47:0] des_mac , //发送的目标MAC地址 input [31:0] des_ip , //发送的目标IP地址 input [31:0] crc_data , //CRC校验数据 input [7:0] crc_next , //CRC下次校验完成数据 output reg tx_done , //以太网发送完成信号 output reg gmii_tx_en , //GMII输出数据有效信号 output reg [7:0] gmii_txd , //GMII输出数据 output reg crc_en , //CRC开始校验使能 output reg crc_clr //CRC数据复位信号 ); //parameter define //开发板MAC地址 00-11-22-33-44-55 parameter BOARD_MAC = 48'h00_11_22_33_44_55; //开发板IP地址 192.168.1.10 parameter BOARD_IP = {8'd192,8'd168,8'd1,8'd10}; //目的MAC地址 ff_ff_ff_ff_ff_ff parameter DES_MAC = 48'hff_ff_ff_ff_ff_ff; //目的IP地址 192.168.1.102 parameter DES_IP = {8'd192,8'd168,8'd1,8'd102}; localparam st_idle = 5'b0_0001; localparam st_preamble = 5'b0_0010; localparam st_eth_head = 5'b0_0100; localparam st_arp_data = 5'b0_1000; localparam st_crc = 5'b1_0000; localparam ETH_TYPE = 16'h0806 ; //以太网帧类型 ARP协议 localparam HD_TYPE = 16'h0001 ; //硬件类型 以太网 localparam PROTOCOL_TYPE= 16'h0800 ; //上层协议为IP协议 //以太网数据最小为46个字节,不足部分填充数据 parameter MIN_DATA_NUM = 16'd46 ; reg [4:0] c_state,n_state; reg skip_en; reg [7:0] preamble[7:0]; reg [7:0] eth_head[13:0]; reg [7:0] arp_data[27:0]; reg [10:0] data_cnt; reg arp_tx_en_d0,arp_tx_en_d1; wire pos_arp_tx_en; assign pos_arp_tx_en=arp_tx_en_d0&(~arp_tx_en_d1); always@(posedge clk or negedge rst_n) begin if(!rst_n) c_state<=st_idle; else c_state<=n_state; end always@(*) begin case(c_state) st_idle: //要加begin end 吗? if(skip_en) n_state=st_preamble; else n_state=st_idle; st_preamble: if(skip_en) n_state=st_eth_head; else n_state=st_preamble; st_eth_head: if(skip_en) n_state=st_arp_data; else n_state=st_eth_head; st_arp_data: if(skip_en) n_state=st_crc; else n_state=st_arp_data; st_crc: if(skip_en) n_state=st_idle; else n_state=st_crc; default:n_state=st_idle; endcase end always@(posedge clk or negedge rst_n) begin if(!rst_n) begin arp_tx_en_d0<=0; arp_tx_en_d1<=0; end else begin arp_tx_en_d0<=arp_tx_en; arp_tx_en_d1<=arp_tx_en_d0; end end always@(posedge clk or negedge rst_n) begin if(!rst_n) begin tx_done<=0; gmii_tx_en<=0; gmii_txd<=0; crc_en<=0; crc_clr<=0; skip_en<=0; data_cnt<=0; preamble[0]<=8'h55; //前导码+帧起始界定符 preamble[1]<=8'h55; preamble[2]<=8'h55; preamble[3]<=8'h55; preamble[4]<=8'h55; preamble[5]<=8'h55; preamble[6]<=8'h55; preamble[7]<=8'hd5; eth_head[0]<=8'h00; //上位机mac地址 eth_head[1]<=8'h00; eth_head[2]<=8'h00; eth_head[3]<=8'h00; eth_head[4]<=8'h00; eth_head[5]<=8'h00; eth_head[6]<=BOARD_MAC[47:40]; //板子mac地址 eth_head[7]<=BOARD_MAC[39:32]; eth_head[8]<=BOARD_MAC[31:24]; eth_head[9]<=BOARD_MAC[23:16]; eth_head[10]<=BOARD_MAC[15:8]; eth_head[11]<=BOARD_MAC[7:0]; eth_head[12]<=ETH_TYPE[15:8]; //长度类型 eth_head[13]<=ETH_TYPE[7:0]; arp_data[0]<=HD_TYPE[15:8]; arp_data[1]<=HD_TYPE[7:0]; arp_data[2]<=PROTOCOL_TYPE[15:8]; arp_data[3]<=PROTOCOL_TYPE[7:0]; arp_data[4]<=8'h06; arp_data[5]<=8'h04; arp_data[6]<=8'h00; arp_data[7]<=8'h00; arp_data[8]<=8'h00; //上位机mac地址 arp_data[9]<=8'h00; arp_data[10]<=8'h00; arp_data[11]<=8'h00; arp_data[12]<=8'h00; arp_data[13]<=8'h00; arp_data[14]<=DES_IP[31:24]; //上位机IP地址 arp_data[15]<=DES_IP[23:16]; arp_data[16]<=DES_IP[15:8]; arp_data[17]<=DES_IP[7:0]; arp_data[18]<=BOARD_MAC[47:40]; //板子mac地址 arp_data[19]<=BOARD_MAC[39:32]; arp_data[20]<=BOARD_MAC[31:24]; arp_data[21]<=BOARD_MAC[23:16]; arp_data[22]<=BOARD_MAC[15:8]; arp_data[23]<=BOARD_MAC[7:0]; arp_data[24]<=BOARD_IP[31:24]; //板子IP地址 arp_data[25]<=BOARD_IP[23:16]; arp_data[26]<=BOARD_IP[15:8]; arp_data[27]<=BOARD_IP[7:0]; end else begin skip_en<=0; tx_done<=0; crc_clr<=0; case(n_state) st_idle:begin if(pos_arp_tx_en) begin skip_en<=1; gmii_tx_en<=1; if(des_mac!=0||arp_tx_type==1) begin eth_head[0]<=des_mac[47:40]; //arp_tx_type==1表示发给上位机的应答信号 eth_head[1]<=des_mac[39:32]; eth_head[2]<=des_mac[31:24]; eth_head[3]<=des_mac[23:16]; eth_head[4]<=des_mac[15:8]; eth_head[5]<=des_mac[7:0]; arp_data[6]<=8'h02; arp_data[8]<=des_mac[47:40]; //上位机mac地址 arp_data[9]<=des_mac[39:32]; arp_data[10]<=des_mac[31:24]; arp_data[11]<=des_mac[23:16]; arp_data[12]<=des_mac[15:8]; arp_data[13]<=des_mac[7:0]; end else begin eth_head[0]<=DES_MAC[47:40]; // eth_head[1]<=DES_MAC[39:32]; //广播地址48'hff_ff_ff_ff_ff_ff eth_head[2]<=DES_MAC[31:24]; eth_head[3]<=DES_MAC[23:16]; eth_head[4]<=DES_MAC[15:8]; eth_head[5]<=DES_MAC[7:0]; arp_data[6]<=8'h01; arp_data[8]<=DES_MAC[47:40]; //上位机mac地址 arp_data[9]<=DES_MAC[39:32]; arp_data[10]<=DES_MAC[31:24]; arp_data[11]<=DES_MAC[23:16]; arp_data[12]<=DES_MAC[15:8]; arp_data[13]<=DES_MAC[7:0]; end end end st_preamble:begin data_cnt<=data_cnt+1; gmii_txd<=preamble[data_cnt]; if(data_cnt==7) begin skip_en<=1; data_cnt<=0; end else skip_en<=0; end st_eth_head:begin data_cnt<=data_cnt+1; crc_en<=1; //还是在上个状态结束时拉高呢? gmii_txd<=eth_head[data_cnt]; if(data_cnt==13) begin skip_en<=1; data_cnt<=0; end end st_arp_data:begin data_cnt<=data_cnt+1; if(data_cnt<=27) gmii_txd<=arp_data[data_cnt]; else if(data_cnt>27&&data_cnt<MIN_DATA_NUM-1) begin gmii_txd<=8'h00; //填充字段为0 end else if(data_cnt==MIN_DATA_NUM-1) begin gmii_txd<=8'h00; skip_en<=1; data_cnt<=0; crc_en<=0; end end st_crc:begin data_cnt<=data_cnt+1; if(data_cnt==0) gmii_txd<={~crc_next[0],~crc_next[1],~crc_next[2],~crc_next[3], ~crc_next[4],~crc_next[5],~crc_next[6],~crc_next[7]}; else if(data_cnt==1) gmii_txd<={~crc_data[16],~crc_data[17],~crc_data[18],~crc_data[19], ~crc_data[20],~crc_data[21],~crc_data[22],~crc_data[23]}; else if(data_cnt==2) gmii_txd<={~crc_data[8],~crc_data[9],~crc_data[10],~crc_data[11], ~crc_data[12],~crc_data[13],~crc_data[14],~crc_data[15]}; else if(data_cnt==3) begin gmii_txd<={~crc_data[0],~crc_data[1],~crc_data[2],~crc_data[3], ~crc_data[4],~crc_data[5],~crc_data[6],~crc_data[7]}; skip_en<=1; data_cnt<=0; gmii_tx_en<=0; tx_done<=1; crc_clr<=1; end end endcase end end endmodule
最新发布
07-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值