readme.txt

来自「网络处理器例子程序」· 文本 代码 · 共 233 行

TXT
233
字号
//------------------------------------------------------------------------------------
//                                                                      
//                   I N T E L   P R O P R I E T A R Y                   
//                                                                       
//      COPYRIGHT (c)  1998-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                  
//                                                                       
//------------------------------------------------------------------------------------
/////////////////////////////////////////////////////////////////////////////
//
//
//      File Name: readme.txt
//
//      Purpose: 
//
//      History:
//
//
//      Date            Comment                         By
//      ---------------------------------------------------------------------
//
//      10/23/2001      Created                         David Meng
//
//
/////////////////////////////////////////////////////////////////////////////

This is the readme file for CAM example code.


1. Introduction
   This example code is designed to demonstrate how to use ixp2400 and ixp2800
   assembly language to develop micro code in order to implement the CAM functions.

2. Source, project and text files in the project
   There are total 10 files in this project.  User should check and make sure all these files
   are in the project directory before using the example code.
  
  2.1 Readme.txt: This file
  
  2.2 cam_example.uc: Root file of the project.  This file details how to use the CAM macros
      to initialize CAM entries, dispaly CAM contents and do CAM lookup.  

  2.3 cam_example_util.uc: This is the utility file for this project.  There are total 12
       macros defined in the file in order to show the users how to program the CAM in micro 
       code project.
       2.3.1 cam_init_from_dram: initialize CAM entries using DRAM preset data
       2.3.2 cam_entry_to_dram: Copy all CAM entries to the DRAM for examination
       2.3.3 cam_init_from_sram:  initialize CAM entries using SRAM preset data
       2.3.4 cam_entry_to_sram: Copy all CAM entries to the SRAM for examination
       2.3.5 get_cam_lookup_result: Do a CAM lookup and parse CAM look up result as
             status, entry and state. 
       2.3.6 miss_hit_count_update: Update hit/miss count values 
       2.3.7 cam_lookup_test: Test CAM lookup.  This macro uses the SRAM and DRAM 
             initialization value do a CAM lookup and update hit/miss count
       2.3.8 cam_lookup_analyze_sram: Step by step analyze CAM look up result using 
             SRAM hit/miss value
       2.3.9 cam_lookup_analyze_dram: Step by step analyze CAM look up result using 
             DRAM hit/miss value
       2.3.10 cam_lookup_lm_sram: Using look up result set local momery base address 
              using SRAM hit/miss values
	   2.3.11 cam_lookup_lm_dram: Using look up result set local momery base address 
              using DRAM hit/miss values
       2.3.12 lm_rd_wr_test: Local memory read and write test
   
  2.4 cam_example.h:  This is the header file. The constants used in this project are defined 
                      in this file.
  
  2.5 cam_example_ixp2400_init.ind: This is the script file for ixp2400 platform. This file sets DRAM
                       and SRAM initialization values for the CAM entries.
  
  2.6 cam_example_ixp2800_init.ind: This is the script file for ixp2800 platform. This file 
                       sets SRAM initialization values for the CAM entries.  The DRAM script 
                       statment such ast set_dram and get_dram can not work currently so no 
                       DRAM initialization is done in this file.

  2.7 cam_example_ixp2400.dwp: This is the project file for the ixp2400 platform which defines 
                       assembler and linker options for the project.  Following are options 
                       defined in this file:
          SIMULATION: Define for simulation
          DEBUG_CAM: Define for dewbug CAM example code
          _CAM_INIT_FROM_SRAM: Define for initialize the CAM entry from SRAM initial values
          _CAM_INIT_FROM_DRAM: Define for initialize the CAM entry from DRAM initial values
          _DRAM_OFFSET=0: Define DRAM offset for the micro engine
          _SRAM_OFFSET=0: Define SRAM offset for the Micro engine

  2.8 cam_example_ixp2400.dwo: This is the project file for the ixp2400 platform which is used to 
                       rebuild the project

  2.9 cam_example_ixp2800.dwp: This is the project file for the ixp2800 platform which defines 
                       assembler and linker options for the project. Refer to 2.7 for detail.

  2.10 cam_example_ixp2800.dwo: This is the project file for the ixp2800 platform which is used
                      to rebuild the project

3. Execution:
   This example code is built and tested for the ixp2400 and ixp2800 simulators.  In order
   to  execute the project, users need to have the workbench which supports both Sausaltio 
   and ixp2800 platforms.  For the ixp2400, the support_routine.ind is required and for 
   ixp2800, the support_routine_ixp2800.ind is required.  Following is step by step operation 
   in executing the example code: 

   3.1 Bring up the work bench

   3.2 In file menu, select open project

   3.3 Open cam_example_ixp2400.dwp for ixp2400 or open cam_example_ixp2800.dwp for ixp2800 patform

   3.4 Use build menu do a buidl/rebuild to build .list  and .uof files

   3.5 Start debug

   3.6 When the initialization is finished (see a Ready on the bottom), use dump_sram or 
       dump_dram check the initilization value.  The SRAM initialization is used in following
       example. A user can do the same thing using DRAM initialization. 

       SRAM initial example is shown here (in build settings: define _CAM_INIT_FROM_SRAM)
        SRAM[0x8c] = 0x0
        SRAM[0x88] = 0x0
        SRAM[0x84] = 0x0
        SRAM[0x80] = 0x0
        SRAM[0x7c] = 0x0
        SRAM[0x78] = 0x0
        SRAM[0x74] = 0x0
        SRAM[0x70] = 0x0
        SRAM[0x6c] = 0x0
        SRAM[0x68] = 0x0
        SRAM[0x64] = 0x0
        SRAM[0x60] = 0x0
        SRAM[0x5c] = 0x0
        SRAM[0x58] = 0x0
        SRAM[0x54] = 0x0
        SRAM[0x50] = 0x0
        SRAM[0x4c] = 0xfedcba98
        SRAM[0x48] = 0xffffffff
        SRAM[0x44] = 0xeeeeeeee
        SRAM[0x40] = 0xdddddddd
        SRAM[0x3c] = 0xcccccccc
        SRAM[0x38] = 0xbbbbbbbb
        SRAM[0x34] = 0xaaaaaaaa
        SRAM[0x30] = 0x99999999 
        SRAM[0x2c] = 0x88888888
        SRAM[0x28] = 0x77777777
        SRAM[0x24] = 0x66666666
        SRAM[0x20] = 0x55555555
        SRAM[0x1c] = 0x44444444
        SRAM[0x18] = 0x33333333
        SRAM[0x14] = 0x22222222
        SRAM[0x10] = 0x11111111
      
      In SRAM, the initial valuses are stored in SRAM from 0x10 to 0x4c as shown above.  The 
      example code will read these values and write them to the 16 entries of the CAM.  And 
      then, the example code will read each entry from the CAM and put the tag to the SRAM 
      from 0x50 to 0x8c.
  
  3.7 Check if the CAM is initialized correctly.  As mentioned in 3.6, the example code store
      the CAM entries in the SRAM, so use the dump_sram to watch if the CAM is initialized 
      correctly.
      Following is the operation:
  
       tc0.PLT0_T_CLK:6477.50> dump_sram(0x50, 0x8c);
       SRAM[0x8c] = 0xfedcba98
       SRAM[0x88] = 0xffffffff
       SRAM[0x84] = 0xeeeeeeee
       SRAM[0x80] = 0xdddddddd
       SRAM[0x7c] = 0xcccccccc
       SRAM[0x78] = 0xbbbbbbbb
       SRAM[0x74] = 0xaaaaaaaa
       SRAM[0x70] = 0x99999999
       SRAM[0x6c] = 0x88888888
       SRAM[0x68] = 0x77777777
       SRAM[0x64] = 0x66666666
       SRAM[0x60] = 0x55555555
       SRAM[0x5c] = 0x44444444
       SRAM[0x58] = 0x33333333
       SRAM[0x54] = 0x22222222
       SRAM[0x50] = 0x11111111

     From above data, it is shown the readback CAM entry tag values are the same as the 
     initial values.  This result shows the example code can initialize the CAM using 
     SRAM value correctly.

  3.8 A user can set break point in macro cam_lookup_analyze_sram and cam_lookup_lm_sram to 
      watch the lookup opeartion.  The source code has the detail information for each lookup.

  3.9 Statistic.  The macro cam_lookup_test is executed at the end of the root file.  This 
      macro will compute the hit/miss count for both SRAM and DRAM initial values.  The 
      SRAM hit count value is stored in SRAM 0x100 and miss count is stored in SRAM 0x104. 
      These SRAM units are cleaned by the init script file.  In this example, the CAM is 
      initialized using SRAM value so the SRAM hit count will be 16 and SRAM miss count will 
      be 0.
      
      The DRAM hit count value is stored in DRAM 0x100 and miss count is stored in DRAM 0x104.
      These DRAM uints are cleaned by the init script file. In this example, the CAM is 
      initialized using SRAM value so the DRAM hit count will be 0 and DRAM miss count will 
      be 16.
      
      Following is the operation how to examine the count values:

        tc0.PLT0_T_CLK:6477.50> dump_sram(0x100, 0x104);
        SRAM[0x104] = 0x0
        SRAM[0x100] = 0x10
        tc0.PLT0_T_CLK:6477.50> dump_dram(0x100, 0x108);
        DRAM[0x104] = 0x10
        DRAM[0x100] = 0x0

4. Other required supports
   This project needs ixpblock macro lib support.  Two files from the lib are used 

   4.1 constants.uc

   4.2 stdmac.uc

5. Issues
   When define using DRAM initialization data, the program takes about 6000 cycles
   to finish.
   
   Another bug found is the set_dram(..., 0xf*******) will not work correctly.  This
   will be a potential problem to store CAM initialization value in the DRAM by using
   the script file. 

6. References
   ixp2800 PRM

⌨️ 快捷键说明

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