版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、顶层结构:phy_rx_clkphy_rx_data_validphy_rx_errphy_tx_enphy_tx_errphy_resetbphy_resetaphy_ff_tx_data7:0clk_125M_outip_receiveclk50Mphy_rx_data7:0button_resetphy_rx_data_validphy_rx_errmac数据模块和IP核模块:data_modulemac_reg_addr7:0clk50M/ff_tx_clknersetclk_125M/tx_clkphy_rx_clkphy_rx_data7:0clk_50M/ff_rx_clkff_
2、tx_sopff_tx_wrenmac_reg_wrenff_tx_data31:0ff_tx_eopmac_datain31:0mac_reg_wr_data31:0phy_ff_tx_data7:0phy_tx_errphy_tx_enmac_endmac_startmac_wr寄存器配置和数据产生模块:clk1_25clk_31_25Mclk_125Mnresetphy_resetbphy_resetapllclk50Mbutton_resetnresetmac_reg_wr_data31:0mac_reg_wrenset_regmac_reg_addr7:0clk50Mrstmac_w
3、rphy_resetaresetbdata_b31:0fifob_flagphy_resetbnresetmac_datain31:0mac_wrclk1_25Mdata_a31:0aclk_31_25Mclk_50Mfifoa_flagfifob_rdfifoa_rdmac_endmac_startnresetclk_50Mfifoa_rdclk_50Mfifob_rda、b结构:packed_generator_comparerdusedw9:0data_a31:0nresetclk_50Mfifoa_rdfifo_wclkfifo_wrenfifo_datain7:0packed_gen
4、erator_fiforandomafifob_flagclk_50Mresetclk1_25Mdffagebpacked_generator_comparerdusedw9:0data_b31:0nresetclk_50Mfifob_rdfifo_wclkfifo_wrenfifo_datain7:0packed_generator_fiforandombfifoa_flagclk_50Mdffagea350350clk_31_25Mresetrandom模块是数据投保协议模块并产生7:0的递增数据,经过fifo将数据以31:0输出,然后rdusedw9:0与350进行比较,比较大小,如果大
5、的话输出fifo_flag=1。表示后面可以添加以太帧。寄存器wr模块状态机:rst _ headcnt=1;datacnt=1fifoa_rd=0;fifoa_rd=0;mac_dataout=0;temp_data=0;mac_wr=0;mac_start=0;mac_end=0;wr_num=0;flag=0;channel_sel=0;s2flag=1s0rstfifob_flag=1_ _ channel_sel=1;flag=0s1flag=flag?headcnt=1_ channel_sel=1fifoa_flag=1 _ channel_sel=0;s1状态表:constru
6、ct the mac frame header and first 2bytes of udp payload,total length is 42+2=44 bytesheadcnt条件状态注解1first 4byte of mac headermac_dataout=32h01005e09;wr_num=wr_num+10d1;mac_wr=1;mac_start=1;headcnt=headcnt+9d1;first 4byte of mac header2channel_sel=0mac_dataout=32hchannel_sel=1mac_dataout=32h090a1234;w
7、r_num=wr_num+10d1;mac_start=0;headcnt=headcnt+9d1;3mac_dataout=32h56789abc;wr_num=wr_num+10d1;headcnt=headcnt+9d1;4last 2 byte of mac header and first 2 byte of ip headermac_dataout=32h;wr_num=wr_num+10d1;headcnt=headcnt+9d1;5channel_sel=0mac_dataout=32h0596b3ba;channel_sel=1mac_dataout=32hfd;wr_num
8、=wr_num+10d1;headcnt=headcnt+9d1;6mac_dataout=32h;wr_num=wr_num+10d1;headcnt=headcnt+9d1;7channel_sel=0mac_dataout=32hae7cc0a8;channel_sel=1mac_dataout=32h2e3ac0a8;wr_num=wr_num+10d1;headcnt=headcnt+9d1;8channel_sel=0mac_dataout=32ha865e009;first channel:source ip=192.168.168.101channel_sel=1mac_dat
9、aout=32ha864e009;wr_num=wr_num+10d1;headcnt=headcnt+9d1;second channel:source ip=192.168.168.1009last 2 byte of ip header and first 2 byte of udp headerchannel_sel=0mac_dataout=32h0909d431;fifoa_rd=1;first channel:dest ip=224.9.9.9channel_sel=1mac_dataout=32h090ad431;wr_num=wr_num+10d1;headcnt=headc
10、nt+9d1;fifob_rd=1;second channel:dest ip=224.9.9.1010mac_dataout=32h;wr_num=wr_num+10d1;headcnt=headcnt+9d1;11last 2 byte of udp header and first 2 byte of udp payloadchannel_sel=0temp_data=fifoa_datain;channel_sel=1temp_data=fifob_datain;mac_dataout=32h;wr_num=wr_num+10d1;headcnt=1;state=2b11;no ud
11、p checksum,first 2 byte of udp payload is 0x0000s2状态表:construct the rest part of udp payload ,total length is 350*4=1400bytesdatacnt条件状态注解348*datacnt=datacnt+9d1;channel_sel=0temp_data=fifoa_datain;fifoa_rd=0;channel_sel=1temp_data=fifob_datain;mac_dataout=temp_data7:0,temp_data15:8,temp_data23:16,t
12、emp_data31:24;wr_num=wr_num+10d1;fifob_rd=0;350datacnt=datacnt+9d1; temp_data=32d0;mac_dataout=temp_data7:0,temp_data15:8,temp_data23:16,temp_data31:24;wr_num=wr_num+10d1;mac_end=1;351datacnt=1;temp_data=32d0;mac_dataout=32d0;mac_end=0;mac_wr=0;state=2b00;wr_num=0;elsedatacntdatacnt=datacnt+9d1;chan
13、nel_sel=0temp_data=fifoa_datain;channel_sel=1temp_data=fifob_datain;mac_dataout=temp_data7:0,temp_data15:8,temp_data23:16,temp_data31:24;wr_num=wr_num+10d1;状态描述:S0:将flag信号做一个反转,并定义flag=0&fifoa_flag=1时channel_sel=0;flag=1&fifob_flag=1时channel_sel=1;S1:6+6+2+20+8+1400字节;具体分为a,b;在这里针对a进行描述。b888e3e5efba
14、bc6b3bad6e5c0a8a865c0a80001d +data_in;1、b888e3e5efb5自己电脑本机mac地址;2、abc 板子上mac地址(自己进行配置);3、0800 凡是携带IP包的帧的类型域都是0x0800;4、45000 IP首部/版本5、0596 IP头+数据长度 20+8+1402=1430;6、b3ba 16位标示,每传1位16位标示加1;7、0000 FLAGS/offset位;8、01通过最多路由级数TTL;9、11 UDP协议10、d6e5 checksum数据计算方法:取IP数据报报头部分(20B),数据如下:45 00 05 96 b3 ba 00 0
15、0 01 11 d6 e5 c0 a8 a8 65 c0 a8 00 01 (1)将校验和字段置为0:将d6 e5置为00 00,即变成:45 00 05 96 b3 ba 00 00 01 11 00 00 c0 a8 a8 65 c0 a8 00 01 (2)反码求和4500 + 0596 /021c+ b3ba + 0000 + 0111 + 0000 + c0a8 + a865 + c0a8 + 0001 = 32917 将将进位(3)加到低16位(2917)上:0003+2917=291a;(3)取反码 将291a取反得:checksum= d6e511010 = 291a00101
16、 = d6e5;11、c0a8a865 源IP地址,板子上自定义的IP地址;12、c0a80001目的IP地址,pc机上使用的协议4静态地址;13、d431 源端口号1771目的端口号(不用更改)14、0582 UDP头+数据长度8+1402=1410 0x582;15、 0000 检验校验checksum是否正确计算方法 :(1)对首部中每个16 bit进行二进制反码求和;(2)将(1)中得到的和再取反码 ,看是否为0.接收到的IP数据报首部:45 00 05 96 b3 ba 00 00 01 11 d6 e5 c0 a8 a8 65 c0 a8 00 01下面来验证下:(1)反码求和45
17、00+0030+804c+4000+8006+b52e+d343+117b+cb51+153d=3fffc4500 + 0596 + b3ba + 0000 + 0111 + d6e5 + c0a8 + a865 + c0a8 + 0001 = 3fffc0003+fffc=ffff;(2)取反码:ffff=0 正确16、 0000 两字节的UDP载荷17、data_in;random中产生的data_in包含了数据头包协议,在数据段用户使用自定义应用时(例如传输图片)使用该协议对数据进行一个加协议头的操作;S2:数据传输状态datacnt=348时将fifo_rd=0进行清零操作;datac
18、nt=350时mac_end=1;拉低输入使能信号;datacnt=351时所有数据置零并回到S0状态;其他mac_dataout=temp_data7:0,temp_data15:8,temp_data23:16,temp_data31:24;使用SignalTap II结果现使用512字节数据,需要更改如下:0596 IP头+数据长度 20+8+1402=1430,改为0x21c = 20+8+512=540;d6e5 checksum数据 改为25a0;0582 UDP头+数据长度8+1402=1410改为8+512 =520 = 0x208;compare模块中将350更改为143;注
19、释:512中包括2字节udp载荷以及数据头包协议部分IP核接口ff_tx_crc_fwd:插入CRC 校验码,如果该端口和tx_ff_eop 一起设置为0,则自动计算CRC 并且插入到帧中。负责,将不会插入。接GND;ff_tx_data31:0/mac_datain31:0 : 发送信息, 发送的第一个字节是mac_datain31:24,第二个字节是mac_datain23:16,;ff_tx_eop/mac_end:一帧传送结束的标志位,设为1 证明最后一位传送完毕;ff_tx_err:接GND,错误提示信号,若最后一字节被设定则证明前面的信息无效;ff_tx_mod1:0:接GND,证明ff_tx_data31:0是有效的。其他不同的状态代表:11: ff_tx_data23:0无效;10: ff_tx_data15:0无效;01: ff_tx_data7:0无效;ff_tx_sop/mac_start:一帧开始发送的标志,设为1 表示开始;ff_tx_wren/mac_wr:写入信号使能,证明ff_tx_data,ff_tx_sop,ff_tx_eop 的有效性;ff_tx_clk/clk_50M:发
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 企业管理制度着装规范
- 规范儿童化妆品管理制度
- 预检首诊制度及流程规范
- 精神科规范服药管理制度
- 食堂亚克力制度规范标准
- 物料申请及使用规范制度
- 110报警台规范制度
- 学校报警设备制度规范
- 电子秤校验制度规范标准
- 四川三江汇海融资租赁有限公司2025年第四批员工公开招聘的备考题库及一套参考答案详解
- 2025中国钢研秋季校园招聘火热进行中笔试参考题库附带答案详解
- 10.2 常见的酸和碱(课件)-2024-2025学年九年级化学人教版下册
- 第8节-万能转换开关
- 2024电力智能录波器技术规范
- 《中国慢性阻塞性肺疾病基层诊疗与管理指南(2024年)》解读课件
- 2024学年绵阳中学高二数学(上)期末考试卷附答案解析
- 女性肿瘤患者的生育力保存
- 暨南大学《法理学》2023-2024学年第一学期期末试卷
- 小学课后服务经费管理方案
- 设备购买合同模板示例
- 道路绿化养护道路绿化养护方案
评论
0/150
提交评论