亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
欧美一级欧美三级在线观看| 捆绑调教一区二区三区| 亚洲欧洲www| 一区二区三区欧美日韩| 午夜精品123| 国产精品一区二区果冻传媒| 国产麻豆欧美日韩一区| 欧美亚洲综合一区| 日韩av在线发布| 欧美在线你懂的| 欧美成人一级视频| 国产日本欧洲亚洲| 自拍偷拍亚洲欧美日韩| 亚洲一区二区三区四区的 | 五月天激情综合网| 亚洲小说欧美激情另类| 天天综合天天综合色| 成人午夜在线免费| 日韩精品一区二区三区四区视频 | 久久九九影视网| 亚洲蜜臀av乱码久久精品| 日韩中文字幕区一区有砖一区| 成人性色生活片免费看爆迷你毛片| 91九色02白丝porn| 亚洲人成小说网站色在线 | 亚洲电影一区二区三区| 色94色欧美sute亚洲13| 亚洲婷婷在线视频| 成人亚洲精品久久久久软件| 久久精品这里都是精品| 国产在线精品一区二区不卡了| 欧美日韩三级一区| 天天色天天爱天天射综合| 欧美精品日韩一区| 久久99久久精品| 久久久久久久久蜜桃| 国产在线日韩欧美| 国产精品视频观看| 色婷婷亚洲综合| 五月天激情小说综合| 日韩欧美国产综合| 99久久er热在这里只有精品66| 国产亚洲精品7777| 日本乱人伦aⅴ精品| 亚洲国产视频a| 久久影院午夜片一区| 成人污污视频在线观看| 亚洲在线免费播放| 欧美成人艳星乳罩| 色综合久久久久| 国产盗摄视频一区二区三区| 亚洲最新在线观看| 久久精品一二三| 91精品国产91久久久久久一区二区| 国产精品亚洲第一区在线暖暖韩国 | 欧美sm极限捆绑bd| 91丨porny丨在线| 经典三级一区二区| 一区二区高清视频在线观看| 欧美成人精品高清在线播放 | 日韩一区在线看| 精品福利一二区| 欧美福利一区二区| 欧美性生交片4| 日本精品一区二区三区四区的功能| 久久99精品国产.久久久久久| 亚洲图片一区二区| 一区二区三区日韩| 亚洲人成亚洲人成在线观看图片| 国产精品女人毛片| 国产人久久人人人人爽| 欧美精品一区二区久久婷婷| 欧美一区二区三区日韩| 欧美乱熟臀69xxxxxx| 色综合久久综合网| 欧美亚洲免费在线一区| 欧洲视频一区二区| 欧美又粗又大又爽| 3d动漫精品啪啪1区2区免费 | 国产亚洲人成网站| 91精品国产日韩91久久久久久| 久久免费午夜影院| 亚洲制服丝袜在线| 日本一不卡视频| 毛片基地黄久久久久久天堂| 精品午夜久久福利影院| 国产91精品精华液一区二区三区| www.日韩在线| 欧美精品免费视频| 久久久久国产免费免费| 日韩一区欧美一区| 国产综合色在线视频区| 99久久精品免费看国产免费软件| 色屁屁一区二区| 精品国产百合女同互慰| 中文字幕一区二区三区蜜月| 午夜国产精品一区| 精品一区二区三区在线观看国产| 韩国午夜理伦三级不卡影院| 91丝袜国产在线播放| 在线成人av影院| 中文字幕一区二区三区在线播放 | 成人av电影在线| 日韩欧美亚洲一区二区| 综合分类小说区另类春色亚洲小说欧美| 午夜精品久久久久久久久久| 韩国理伦片一区二区三区在线播放| 成人久久18免费网站麻豆| 日韩精品资源二区在线| 亚洲精品欧美在线| av一二三不卡影片| 久久精品人人做人人综合| 亚洲综合男人的天堂| 色综合久久88色综合天天免费| 国产日韩一级二级三级| 国产一区二区三区| 日韩欧美在线不卡| 视频一区视频二区中文字幕| 91官网在线观看| 亚洲欧美日韩国产手机在线| 成人高清伦理免费影院在线观看| 2020国产精品| 国产精品中文字幕日韩精品 | 国产成人h网站| 中文无字幕一区二区三区| 粉嫩13p一区二区三区| 国产女人aaa级久久久级| 国产不卡在线一区| 亚洲同性同志一二三专区| 色综合久久久网| 午夜av电影一区| 欧美成人女星排行榜| 成人免费毛片嘿嘿连载视频| 亚洲男人都懂的| 日韩免费视频一区| 成人精品免费网站| 一区二区三区鲁丝不卡| 欧美日韩成人激情| 九九精品一区二区| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 91麻豆国产福利精品| 日本麻豆一区二区三区视频| 国产精品嫩草99a| 欧美精品色一区二区三区| 国产在线播放一区二区三区| 亚洲欧美偷拍三级| 日韩欧美综合一区| 色婷婷久久综合| 国产一区二区电影| 亚洲成人动漫在线免费观看| 久久久久免费观看| 日韩美女在线视频| 欧美日韩一区在线观看| 色婷婷综合五月| 国产成人8x视频一区二区| 麻豆成人免费电影| 日韩精品一区第一页| 一区二区三区欧美日| 中文字幕一区二区三区不卡| 26uuu精品一区二区三区四区在线| 欧美剧在线免费观看网站 | 看电影不卡的网站| 日韩av电影免费观看高清完整版| 国产欧美日韩中文久久| 9191国产精品| 欧美亚洲动漫精品| 色综合天天综合在线视频| 国产一区福利在线| 美女诱惑一区二区| 久久精品久久久精品美女| 免费av成人在线| 丁香五精品蜜臀久久久久99网站 | 成人免费毛片片v| 国产99久久久久久免费看农村| 国产最新精品精品你懂的| 看电视剧不卡顿的网站| 美国三级日本三级久久99| 日韩激情在线观看| 免费不卡在线视频| 国产·精品毛片| 99精品热视频| 日韩欧美一区二区三区在线| 久久理论电影网| 一区二区三区在线观看国产| 蜜桃av噜噜一区二区三区小说| 激情五月激情综合网| 播五月开心婷婷综合| 欧美一区二区免费视频| 久久精品亚洲一区二区三区浴池| 亚洲色图欧美在线| 精品无码三级在线观看视频| av午夜精品一区二区三区| 777久久久精品| 中文字幕一区二区三区四区| 蜜臀91精品一区二区三区| 白白色亚洲国产精品| 欧美一区二区三区不卡| 亚洲最大色网站| 高清beeg欧美| 亚洲精品一区二区精华|