📄 readme.txt
字号:
//---------------------------------------------------------------------
//
// I N T E L P R O P R I E T A R Y
//
// COPYRIGHT (c) 2001 BY INTEL CORPORATION. ALL RIGHTS
// RESERVED. NO PART OF THIS PROGRAM OR PUBLICATION MAY
// BE REPRODUCED, TRANSMITTED, TRANSCRIBED, STORED IN A
// RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY LANGUAGE OR COMPUTER
// LANGUAGE IN ANY FORM OR BY ANY MEANS, ELECTRONIC, MECHANICAL,
// MAGNETIC, OPTICAL, CHEMICAL, MANUAL, OR OTHERWISE, WITHOUT
// THE PRIOR WRITTEN PERMISSION OF :
//
// INTEL CORPORATION
//
// 2200 MISSION COLLEGE BLVD
//
// SANTA CLARA, CALIFORNIA 95052-8119
//
//---------------------------------------------------------------------
Byte align example code readme.txt
Introduction
============
This example illustrates the use of the byte_align_be instruction.
It takes as input an ethernet packet in big endian format, strips off
the ethernet header and byte aligns the contained IP packet.
Input : 64 byte ethernet packet from RBUF
Output: Byte aligned 50 byte IP packet into DRAM
Example
=======
64 byte ethernet packet: 00010203 04050607 08091011 12131415 .... 60616263
Bytes : 0-3 4-7 8-11 12 13 14 15 16-19 .... 48 49 50 51 .... 60-63
--------------------------------------------------------------------------------------------------------
Input : 00010203 04050607 08091011 12 13 14 15 16171819 .... .. .. .. .. .... 60616263
Processing - Strip off first 14 bytes and byte align the rest
of the bytes. Pad last 2 bytes with zeroes.
Output : 14151617 18192021 22232425 .. .. .. .. ........ .... 62 63 00 00
<---------- Bytes 14-63 (50 bytes) of the ethernet packet ----------->
So using a 2 byte shift, bytes 14-63 are aligned on a 4 byte
boundary when stored in SRAM.
How to run the code and verify the result
=========================================
Open the project in the workbench.
To run the code, assemble and start debugging.
Select Go.
Run for at least 3000 cycles.
Select Stop.
Open the data watch window.
rbuf[0:63] should be
0x00112233
0x44556677
0x8899aabb
0x05dd4500
0x002e0000
0x00000406
0x18a61023
0x4567891b
0xcdef0001
0x02030405
0x06070809
0x0a0b0c0d
0x0e0f1011
0x12131415
0x16171819
0xe7ef019b
Open the memory watch window.
dram[80:135] should be
0x00000000 0x4500002e
0x01234567 0x040618a6
0x00010203 0x89abcdef
0x08090a0b 0x04050607
0x10111213 0x0c0d0e0f
0x1819e7ef 0x14151617
0x00000000 0x019b0000
End of Readme.txt
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -