⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readme.txt

📁 网络处理器例子程序1
💻 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                  
;                                                                       
;------------------------------------------------------------------------------------

FFS Example code Readme file


Introduction
============

This is a MEv2 microcoded example that illustrates the sample round robin scheduling 
using the bit vector (where in each bit represents a particular queue) using ffs 
instruction 

In this example only thread 0 is doing the work and other threads are just being 
killed.

It consists of one file ffs.uc

How FFS instruction works
=========================
ffs instruction which finds the first bit set beginning at the LSB in the src reg.

ffs[dest,src]

Dest[4:0] gets the encoded value from 0 to 31 indicating the least significant '1' 
bit in the src. (All other bits of Dest receive '0')

If there are no bits set, the Z condition code is set otherwise Z condition code 
is cleared.


Algorithm
=========

The infinite loop starts by updating the bit vector. (At this stage in real scheduler, 
one can get the updated bit vector from the external source). This algorithm works 
on the temp vector which is obtained by ANDing the bit vector and mask. 

Then ffs instruction is used to get the first bit set at the LSB of the temp vector 
and the ffs result will be in the range[0,0x1f].(So this particular queue number is 
ready for scheduling)

The following steps are done to unclear the set LSB in the temp vector

Then this ffs result is subtracted from 0x1e(30) to get the shift amount for 
arithmetic right shifting the '1' bit, to get the mask. If no bit is set, then the 
mask is reset to all ones. 
(And if MSB is the only bit set, the ffs result will be 0x1f and after 
subtracting it from 0x1e(30), the ffs result will be all ones, so this case has been 
taken care of in the normal flow of loop.)

How to run the code and verify the result
============================================
The example has the bit_vector initialized to some value(0x A400 0002). You can keep 
the data watch on the tmp_vector, ffs_res and mask during each iteration using 
breakpoints, and can see how the mask changes depending on the ffs_res and 
subsequently the tmp_vector too.

For example:
  bit_vector A400 0002

  Following will be the data values for the variables, in different iterations.		 

iteration#	             1st	   2nd	       3rd	    4th		5th
tmp_vector		     a400 0002	a400 0000   a000 0000   8000 0000    a400 0002
ffs_res			     1		    1a	        1d           1f	         1	       .. 
ffs_res(0x1e-ffs_res)1d		    4 	        1           ffff ffff    1d
mask			     ffff fffc	f800 0000   c000 0000   ffff ffff    ffff fffc 



⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -