亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ivm_core.c

?? 在嵌入式系統中對Lattice CPLD軟件升級時所需的VME文件生成所需源代碼。基于E2PROM存儲
?? C
?? 第 1 頁 / 共 3 頁
字號:

/****************************************************************************
                 ispVM Core Of Embedded Version Of ispVM
              Lattice Semiconductor Corp. Copyright 1998 - 2001.           
      ispVME for Embedded Applications Where Resources is A Premium.

  This is the scale down version of the full ispVM target for embedded
  applications. The footprint of this VM is less than 8K bytes in size.    
  Huffman encoding is used to minimize the Virtual Machine Format file size
  without increasing the VM footprint and addtional RAM for decompression  
  is not required.                                                         

  Typically only 100 bytes of RAM is required to hold one row of data when
  processing the VMF file. The VM itself also need less than 100 bytes of  
  RAM to hold all the variables it needs.                                  
  This is the core of the ispVM Embedded. All the high level opcode of the
  ispVM required to support all industry standard SVF constructs are included.

  All ispVM opcodes for decision branching, math and low level bit banging
  are not included to reduce the ispVM Embedded footprint to the minimum.
  Decision branching and math operations are still carried out by ispVM
  Embedded by using native code instead. It is to achieve the highest
  efficiency possible for ispVM Embedded. For example:
  Using native code to add A and B is:  sum=a+b;
  Using ispVM opcode is: PUSH a; PUSH b; ADD sum;
  It is obvious that the ispVM actually interprets the compiled opcode
  and call the appropriate function to perform the action in native code.
  Native code vs ispVM opcode represents respectively the efficiency and
  flexibility trade off. The priority number one for ispVM Embedded is
  efficiency. 
  The functional blocks:
  ispVMCode()        Extract and interpret the ispVM high level opcodes.
  ispVMDataCode()    Extract and interpret ispVM data type opcode.
  ispVMDataSize()    Extract the operand of size (a 16 bit number).
  ispVMData()        Extract and decompress one row of data stream.

4/26/01  Add support to a non-zero HIR, HDR, TIR and TDR for multiple devices
         in one SVF file. 
8/23/01  Add support to cascading turn on and off.
         Add some sort of flow control to support the program the part if usercode 
         verify fail requirement.
         Add support of repeat looping for vme file size reduction.
12/03/01 Checks for SECUREHEAP opcode immediately following HEAP opcode to 
         maintain VME integrity
tnt 03/13/02 New opcodes added CRC, CMASK, READ, and RMASK to calculate data
			 CRC and perform Read and Save.
3/25/02	tnt	No longer issue DRPAUSE/IRPAUSE to the state machine after sending
			or receiving data
1/15/04 Support cascade by checking is current state is SHIFTDR.  If SHIFTDR is active,
        then do not step into DRPAUSE.
2/11/04	Remove IEEE 1532 support.
*****************************************************************************/
#include <stdio.h>
#include "vmopcode.h"
#include "hardware.h"

#ifdef VME_DEBUG
#include "debug.h"
#endif

unsigned short usFlowControl = 0x0000,   /*Flow control register*/
               usDataType = 0x0000;      /*holds the data type of the current row
                                         default is all operations selected*/
extern unsigned char * OutMaskData,    /*holds Mask data*/
                     * InData,      /*holds data to be shift into device*/
					 * OutData,     /*holds data to be compared with those read from device*/
					 * HIRData,     /*holds data of SIR header*/
					 * TIRData,     /*holds data of SIR trailer*/
					 * HDRData,     /*holds data of SDR header*/
					 * TDRData,     /*holds data of SDR trailer*/
					 * OutDMaskData;/*holds DMask data*/

extern char cCurrentJTAGState;
extern unsigned char * pucHeapMemory;     /*holds the repeat loop*/
extern unsigned short iHeapCounter;   /*holds the current byte address of the Heap*/

/*set all to default*/
static unsigned char
      End_DR = DRPAUSE,   /*after shift data, part at PAUSE DR by default*/
      End_IR = IRPAUSE;   /*after shift IR, part at PAUSE IR by default */
static unsigned short
      HeadDR = 0,         /*the number of lead devices in bypass*/
      HeadIR = 0,         /*the sum of IR length of lead devices*/
      TailDR = 0,         /*the number of tail devices in bypass*/
      TailIR = 0;         /*the sum of IR length of tail devices*/

static unsigned short usiDataSize = 0; /*the number(bits) of data or instruction
                                         to be shifted into or out from devices*/
extern unsigned short iHEAPSize;                   /*the number of bytes in the HEAP*/
unsigned short Frequency = 1000;        
static unsigned short MaxSize = 0;          /*the maximum amount of rams(bytes) needed to
                                                  hold a row of data*/
unsigned short iShiftValue = 0;           /*holds the updated value of LSH or RSH*/
unsigned short RepeatLoops= 0;            /*holds the current repeat loop value*/
unsigned short rightShift = 0;   /*holds permission to rightShift or not*/
char cVendor;                  /*holds the name of the vendor*/

extern char GetByte(void);
extern void ispVMMemManager(char types, unsigned short size);

/*prototypes*/
char ispVMCode(void);
char ispVMDataCode(void);
unsigned short ispVMDataSize(void);
void ispVMData(unsigned char *Data);
char ispVMShift(char Code);
char ispVMAmble(char Code);
char ispVMLoop( unsigned short a_usLoopCount );
char ispVMBitShift(char mode, unsigned short bits);

/****************************************************************************
                     ispVMDataSize                       
 Extract the data size of the current row from the VME file.  
 Return                                                                
     usiDataSize-----------The data bit length of the current row.     
*****************************************************************************/
unsigned short ispVMDataSize()
{
	unsigned short usiSize = 0;
	char cCurrentByte, cIndex;
	
	cIndex = 0;
	while ( ( cCurrentByte = GetByte() ) & 0x80 ) {
		usiSize |= ( ( unsigned short ) ( cCurrentByte & 0x7F ) ) << cIndex;
		cIndex += 7;
	}
	usiSize |= ( ( unsigned short ) ( cCurrentByte & 0x7F ) ) << cIndex;
	return usiSize;
}

/****************************************************************************
                     ispVMCode                                
 This is the core of ispVM Embedded. The ispVM opcodes are extracted and
 interpreted in this module. The ispVM opcodes supported here are only
 high level ispVM opcodes. High level opcodes simplify users' task in
 creating the VME files. For example:
 To scan an instruction into the targeted device(s), the VME program is:
 SVF:  SIR 5 TDI (0x0A);
 VME:  0x01,0x00,0x05,0x03,0x50,0x00;
       SIR opcode = 0x01;
       size = 0x00, 0x05;
       TDI opcode = 0x03;
       data = 0x50 which is reverse of 0x0A;
       ENDDATA opcode = 0x00;
 The high level opcode is splitted into multiple low level tasks by the ispVM
 Embedded:
  task 1: Fetch and keep all the operands, size and data stream etc.
          Allocate memory if necessary to keep the operands.
  task 2: Move the BSCAN state of the device to IRPAUSE.
  task 3: Put the leading and trailing devices into BYPASS mode.
  task 4: Move the BSCAN state machine to Shift-IR state.
  task 5: Shift the data stream into the target device(s);
  task 6: Move the BSCAN state machine to IRPAUSE.
  task 7: Move the BSCAN state machine to state as specified by ENDDR opcode.
  task 8: Put the leading and trailing devices into BYPASS mode.
 If low level opcodes are used instead, each task will require an opcode.
 This will go against the objective of having a small VME file size and
 fast programming time.
 Return                       
 Global var:                            
  compression --read instruction without compression read data with
                compression  
  tdodata     --true if TDO opcode is detected to indicate reading is
                necessary
  express     --true if EXPRESS SDR(XSDR) token is detected.
                XSDR will be carried out with Input data transferred to
                Output data buffer for next verify against. The XTDO opcode
                does not have data. The effect is to reduce the VME file
                size by half.                                
  usiDataSize    --the number of bits of data to be processed   
*****************************************************************************/
char ispVMCode()
{
	unsigned short iRepeatSize;
	char cOpcode;
	char cRetCode = 0;

#ifdef VME_DEBUG
	unsigned short siDebugRow = 0;
	unsigned short iOpcodeIndex;
#endif
	
	while ( ( cOpcode = GetByte() ) >= 0 ) { /* All opcode except ENDFILE are all positive */
#ifdef VME_DEBUG
		siDebugRow++;
		for ( iOpcodeIndex = 0; iOpcodeIndex < iOpcodeCount; iOpcodeIndex++ ) {
            if ( ispVMOpcodes[ iOpcodeIndex ].token == cOpcode ) {
				break;
			}
		}
		printf( "Row = %d Opcode = %s\n", siDebugRow, ispVMOpcodes[ iOpcodeIndex ].text );        
#endif
		switch ( cOpcode ) {
		case STATE: /*step BSCAN state machine to specified state*/
			ispVMStateMachine( GetByte() );
			break;
		case SIR:   /*shift instruction stream into devices*/
		case SDR:   /*shift data stream into devices*/
		case XSDR:
			cRetCode = ispVMShift( cOpcode );
			if ( cRetCode != 0 ) {
				return ( cRetCode );
			}
			break;
		case WAIT:  /*opcode to wait for specified time in us or ms*/      
			ispVMDelay( ispVMDataSize() );
			break;
		case TCK:   /*pulse TCK signal the specified time*/
			ispVMClocks( ispVMDataSize() );
			break;
		case ENDDR: /*modify the BSCAN state after SDR opcode*/
			End_DR = GetByte();
			break;
		case ENDIR: /*modify the BSCAN state after SIR opcode*/
			End_IR = GetByte();
			break;
		case HIR:   /*modify the IR length of lead devices*/
		case TIR:   /*modify the IR length of the trailing devices*/
		case HDR:   /*modify the DATA length of the lead devices*/
		case TDR:   /*modify the DATA length of the trailing devices*/
			cRetCode = ispVMAmble( cOpcode );
			if ( cRetCode != 0 ) {
				return ( cRetCode );
			}
			break;
		case MEM:   /*The maximum RAM required for current VME file*/
			MaxSize = ispVMDataSize();
			break;
		case VENDOR:
			cOpcode = GetByte();
			switch ( cOpcode ) {
			case LATTICE:
				cVendor = LATTICE;
				break;
			case ALTERA:
				cVendor = ALTERA;
				break;
			case XILINX:
				cVendor = XILINX;
				break;
			default:
				break;
			}
			break;
		case SETFLOW:
			usFlowControl |= ispVMDataSize();
			break;
		case RESETFLOW: /*Clear the continue if fail flag*/
			usFlowControl &= ~( ispVMDataSize() );
			break;
		case HEAP: /*the size of HEAP memory to store loops*/
			cRetCode = GetByte();
			if ( cRetCode != SECUREHEAP ) {
				return -4;
			}
			iHEAPSize = ispVMDataSize();  /*HEAP size in bytes*/
			ispVMMemManager( HEAP, ( unsigned short ) iHEAPSize );
			break;
		case REPEAT:   /*the begin of a monolithic loop*/
			RepeatLoops = 0;
			iRepeatSize = ispVMDataSize();
			
			cRetCode = ispVMLoop( ( unsigned short ) iRepeatSize );
#ifndef VME_DEBUG
			if ( cRetCode != 0 ) {
				return ( cRetCode );
			}
#endif
			break;
		case ENDLOOP:
			return ( cRetCode );  /*force a return*/
		case ENDVME: 
		case ENDFILE:  /*reach end of the current VME file*/ 
			return( cRetCode );    /*return the result*/
		case SHR:
			usFlowControl |= SHIFTRIGHT;
			iShiftValue = RepeatLoops * GetByte();
			break;
		case SHL:
			usFlowControl |= SHIFTLEFT;
			iShiftValue = RepeatLoops * GetByte();
			break;
		case FREQUENCY:
			Frequency = ispVMDataSize();
			break;
		case VUES:
			usFlowControl |= VERIFYUES;
			break;
		default: /* Invalid opcode encountered */
#ifdef VME_DEBUG
			printf( "Illegal opcode (%02X)!\n", cOpcode );
#endif
			return -4;
		}
	}
	
	if ( ( cOpcode < 0 ) && ( cOpcode != ( char ) ENDFILE ) ) {
		return ( -4 ); 
	}
	else {
		return ( cRetCode );
	}
}


/****************************************************************************
                     ispVM Data Code          
This routine is to extract the data operator which follows the TDI, TDO
 and MASK and perform operations on the data stream. The possible
 operator codes are:

 if the data follows has compression, then add 0x80 to the opcode shown

 LOCAL         0x00     the data follows immediately
 SHR           0x01     from data follows immediately
 SHL           0x02     from data follows immediately
 ROMARRAY      0x03     from read only array follows
 RAMARRAY      0x04     from a read and write array
 CPYDATARRAY   0x05     copy to data array (i.e. $addr=1;)
 CPYDATAVAR    0x06     copy to data variable 
 SHLARRAY      0x07     from data array with shift left operation
 SHRARRAY      0x08     from data array with shift right operation
 INVARRAY      0x09     from data array with complement operation
 INCDATA       0x0A     from variable array with increment operation 
 DECDATA       0x0B     from variable array with decement operation 
 INVDATA       0x0C     from variable array with complement operation 
 SHLDATA       0x0D     from variable array with shift left operation
 SHRDATA       0x0E     from varaible array with shift right operation

 This version V9.001 supports only LOCAL and ROMARRAY data operator.
 If other operators are desired, contact Lattice's Application for
 the library functions.

                  
 Extract tdi tdo or mask from the VME file.                     
 Return                                                         
     usDataType------------Set EXPRESS bit true if XTDI, XTDO found. 
                         Set TDI_DATA, TDO_DATA, MASK_DATA bit true if found.
*****************************************************************************/
char ispVMDataCode()
{
	char cDataByte;
	char siDataSource = 0;  /*source of data from file by default*/
 
#ifdef VME_DEBUG
	unsigned short iOpcodeIndex;
#endif
	

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品国产色综合久久不卡电影| 中文字幕一区在线| 视频一区视频二区中文| 精品国产91乱码一区二区三区| 午夜精品在线看| 国产日韩综合av| 蜜臀久久99精品久久久久久9 | 蜜桃视频在线一区| 欧美日韩成人综合| 亚洲一区视频在线| 亚洲一区免费在线观看| 国产精品一色哟哟哟| 樱花影视一区二区| 91视频一区二区三区| 91亚洲精华国产精华精华液| 精品亚洲porn| 亚洲国产wwwccc36天堂| 亚洲欧洲无码一区二区三区| 欧美调教femdomvk| 成人激情综合网站| 麻豆91小视频| 一区二区三区四区国产精品| 国产欧美日韩激情| 91网站在线播放| 国产精品1区2区| 亚洲色图在线视频| 日韩一区二区精品| 欧美三级中文字| 成人免费毛片嘿嘿连载视频| 成人在线综合网站| 国产一区二区三区在线观看免费| 奇米影视在线99精品| 韩国三级中文字幕hd久久精品| 老司机精品视频线观看86| 日韩精品乱码av一区二区| 一区二区三区**美女毛片| 久久精品在线观看| 久久久99精品免费观看| 欧美一区二区日韩一区二区| 欧美熟乱第一页| 亚洲最大的成人av| 视频一区二区三区在线| 日本aⅴ精品一区二区三区| 午夜视频一区二区| 亚洲私人黄色宅男| 日韩高清中文字幕一区| 一区二区三区四区五区视频在线观看| 久久久精品免费观看| 国产亚洲精品资源在线26u| 依依成人精品视频| 亚洲综合一区二区| 亚洲黄网站在线观看| 亚洲一区二区三区四区不卡 | 亚洲精品日日夜夜| 亚洲免费色视频| 自拍偷拍亚洲激情| 亚洲欧洲三级电影| 久久99久久99小草精品免视看| 久久草av在线| 国产福利不卡视频| 国产一区二区在线视频| 在线观看亚洲一区| 欧美一级日韩一级| 日韩免费看网站| 欧美福利视频导航| 精品成a人在线观看| 国产日韩欧美高清| 亚洲精品视频在线看| 国产精品美女久久久久久久网站| 亚洲欧美在线高清| 亚洲成人综合在线| 久久精品国产99| 91视频www| 久久99精品国产.久久久久| 国产一区日韩二区欧美三区| 欧美高清激情brazzers| 欧美精品一区二区在线观看| 国产精品久久久久久久久免费樱桃 | 精品久久久久一区二区国产| 国产视频911| 久久精品亚洲精品国产欧美| 18欧美亚洲精品| 午夜精品久久一牛影视| 精品亚洲成a人在线观看 | 久久蜜桃一区二区| 亚洲欧洲精品一区二区三区| 亚洲综合区在线| 色欧美日韩亚洲| 欧美精品一区二区久久久| 久久久美女毛片| 综合中文字幕亚洲| 奇米在线7777在线精品| 99这里只有久久精品视频| 欧美色倩网站大全免费| 一区二区三区不卡视频| 国产一区二区三区免费观看| 日本精品一级二级| 亚洲区小说区图片区qvod| 久久国产福利国产秒拍| 色噜噜久久综合| 国产亚洲美州欧州综合国| 日韩精品色哟哟| thepron国产精品| 日韩欧美中文字幕公布| 美女视频网站久久| 99国产欧美另类久久久精品| 日韩一区二区三区视频在线| 日韩美女视频一区二区 | 亚洲国产乱码最新视频| 国产在线视频一区二区| 欧美性色欧美a在线播放| 国产日韩欧美精品在线| 国产一区二区精品久久| 日韩一区二区视频| 亚洲夂夂婷婷色拍ww47| 懂色av一区二区夜夜嗨| 中文字幕一区二区三区精华液| 激情成人午夜视频| 欧美日韩国产一区二区三区地区| 久久综合国产精品| 成人影视亚洲图片在线| 欧美一级艳片视频免费观看| 伊人性伊人情综合网| 91玉足脚交白嫩脚丫在线播放| 久久精品一区八戒影视| 久久机这里只有精品| 欧美另类z0zxhd电影| 蜜桃久久久久久| 欧美一区二区三区的| 亚洲福利国产精品| 91在线国产福利| 日韩一区精品视频| 欧美午夜宅男影院| 亚洲人吸女人奶水| 国产一区二区影院| 精品1区2区在线观看| 国产精品色一区二区三区| 国产精品2024| 国产三级一区二区三区| 日本午夜一区二区| 国产欧美一区二区精品婷婷 | 国产精品久久久久久久久久久免费看| 久久99精品久久久| 91麻豆精品国产无毒不卡在线观看| 亚洲午夜视频在线观看| 欧美日韩一区二区三区免费看| 亚洲精品乱码久久久久久久久 | 91福利在线导航| 亚洲视频在线观看三级| 99久久精品99国产精品| 精品成人免费观看| 欧美体内she精视频| 亚洲妇熟xx妇色黄| 欧美日韩视频在线一区二区| 国产成人av在线影院| 国产精品久久久久久久久快鸭 | 精品无人码麻豆乱码1区2区 | 国产成人精品免费视频网站| 亚洲欧美激情一区二区| 欧美在线观看视频在线| 亚洲狠狠爱一区二区三区| 国产精品一区二区免费不卡| 亚洲一本大道在线| 欧美日韩一级片在线观看| 免费观看一级特黄欧美大片| 日韩欧美精品三级| 欧美性受极品xxxx喷水| 国产自产高清不卡| 国产精品天美传媒沈樵| 欧美疯狂做受xxxx富婆| 国产精品1区2区| 亚洲一二三四区| 国产一区二区导航在线播放| 国产精品国产三级国产aⅴ入口| 欧美亚洲国产一区二区三区va| 老司机一区二区| 性做久久久久久久免费看| 精品欧美一区二区在线观看| 成人精品免费视频| 国产精品麻豆欧美日韩ww| 精品国产乱码久久久久久牛牛 | 日韩一二三四区| 欧洲亚洲国产日韩| 久久99热国产| 国产精品网站在线| 波多野结衣亚洲| 亚洲国产精品一区二区久久恐怖片| 欧美日韩免费视频| 国产suv精品一区二区三区| 五月天精品一区二区三区| 久久久久久久久一| 在线亚洲一区二区| 亚洲1区2区3区视频| 亚洲一二三区不卡| 国产性天天综合网| 欧美日韩三级视频| 欧美性高清videossexo| 国产成人免费视频精品含羞草妖精| 午夜私人影院久久久久| 国产精品毛片a∨一区二区三区|