slightly在线编译(slightly中文)
翻译一段中文成英文
FPGA与CPLD的区别
系统的比较,与大家共享:
尽管FPGA和CPLD都是可编程ASIC器件,有很多共同特点,但由于CPLD和FPGA结构上的差异,具有各自的特点:
①CPLD更适合完成各种算法和组合逻辑,FP GA更适合于完成时序逻辑。换句话说,FPGA更适合于触发器丰富的结构,而CPLD更适合于触发器有限而乘积项丰富的结构。
②CPLD的连续式布线结构决定了它的时序延迟是均匀的和可预测的,而FPGA的分段式布线结构决定了其延迟的不可预测性。
③在编程上FPGA比CPLD具有更大的灵活性。CPLD通过修改具有固定内连电路的逻辑功能来编程,FPGA主要通过改变内部连线的布线来编程;FP GA可在逻辑门下编程,而CPLD是在逻辑块下编程。
④FPGA的集成度比CPLD高,具有更复杂的布线结构和逻辑实现。
⑤CPLD比FPGA使用起来更方便。CPLD的编程采用E2PROM或FASTFLASH技术,无需外部存储器芯片,使用简单。而FPGA的编程信息需存放在外部存储器上,使用方法复杂。
⑥CPLD的速度比FPGA快,并且具有较大的时间可预测性。这是由于FPGA是门级编程,并且CLB之间采用分布式互联,而CPLD是逻辑块级编程,并且其逻辑块之间的互联是集总式的。
⑦在编程方式上,CPLD主要是基于E2PROM或FLASH存储器编程,编程次数可达1万次,优点是系统断电时编程信息也不丢失。CPLD又可分为在编程器上编程和在系统编程两类。FPGA大部分是基于SRAM编程,编程信息在系统断电时丢失,每次上电时,需从器件外部将编程数据重新写入SRAM中。其优点是可以编程任意次,可在工作中快速编程,从而实现板级和系统级的动态配置。
⑧CPLD保密性好,FPGA保密性差。
⑨一般情况下,CPLD的功耗要比FPGA大,且集成度越高越明显。
随著复杂可编程逻辑器件(CPLD)密度的提高,数字器件设计人员在进行大型设计时,既灵活又容易,而且产品可以很快进入市场。许多设计人员已经感受到CPLD容易使用、时序可预测和速度高等优点,然而,在过去由于受到CPLD密度的限制,他们只好转向FPGA和ASIC。现在,设计人员可以体会到密度高达数十万门的CPLD所带来的好处。
CPLD结构在一个逻辑路径上采用1至16个乘积项,因而大型复杂设计的运行速度可以预测。因此,原有设计的运行可以预测,也很可靠,而且修改设计也很容易。CPLD在本质上很灵活、时序简单、路由性能极好,用户可以改变他们的设计同时保持引脚输出不变。与FPGA相比,CPLD的I/O更多,尺寸更小。
如今,通信系统使用很多标准,必须根据客户的需要配置设备以支持不同的标准。CPLD可让设备做出相应的调整以支持多种协议,并随著标准和协议的演变而改变功能。这为系统设计人员带来很大的方便,因为在标准尚未完全成熟之前他们就可以著手进行硬件设计,然后再修改代码以满足最终标准的要求。CPLD的速度和延迟特性比纯软件方案更好,它的NRE费用低於ASIC,更灵活,产品也可以更快入市。CPLD可编程方案的优点如下:
●逻辑和存储器资源丰富(Cypress Delta39K200的RAM超过480 Kb)
●带冗余路由资源的灵活时序模型
●改变引脚输出很灵活
●可以装在系统上后重新编程
●I/O数目多
●具有可保证性能的集成存储器控制逻辑
●提供单片CPLD和可编程PHY方案
由于有这些优点,设计建模成本低,可在设计过程的任一阶段添加设计或改变引脚输出,可以很快上市
CPLD的结构
CPLD是属於粗粒结构的可编程逻辑器件。它具有丰富的逻辑资源(即逻辑门与寄存器的比例高)和高度灵活的路由资源。CPLD的路由是连接在一起的,而FPGA的路由是分割开的。FPGA可能更灵活,但包括很多跳线,因此速度较CPLD慢。
CPLD以群阵列(array of clusters)的形式排列,由水平和垂直路由通道连接起来。这些路由通道把信号送到器件的引脚上或者传进来,并且把CPLD内部的逻辑群连接起来。
CPLD之所以称作粗粒,是因为,与路由数量相比,逻辑群要大得到。CPLD的逻辑群比FPGA的基本单元大得多,因此FPGA是细粒的。
CPLD的功能块
CPLD最基本的单元是宏单元。一个宏单元包含一个寄存器(使用多达16个乘积项作为其输入)及其它有用特性。
因为每个宏单元用了16个乘积项,因此设计人员可部署大量的组合逻辑而不用增加额外的路径。这就是为何CPLD被认为是“逻辑丰富”型的。
宏单元以逻辑模块的形式排列(LB),每个逻辑模块由16个宏单元组成。宏单元执行一个AND操作,然后一个OR操作以实现组合逻辑。
每个逻辑群有8个逻辑模块,所有逻辑群都连接到同一个可编程互联矩阵。
每个群还包含两个单端口逻辑群存储器模块和一个多端口通道存储器模块。前者每模块有8,192b存储器,后者包含4,096b专用通信存储器且可配置为单端口、多端口或带专用控制逻辑的FIFO。
CPLD有什麽好处?
I/O数量多
CPLD的好处之一是在给定的器件密度上可提供更多的I/O数,有时甚至高达70%。
时序模型简单
CPLD优于其它可编程结构之处在于它具有简单且可预测的时序模型。这种简单的时序模型主要应归功于CPLD的粗粒度特性。
CPLD可在给定的时间内提供较宽的相等状态,而与路由无关。这一能力是设计成功的关键,不但可加速初始设计工作,而且可加快设计调试过程。
粗粒CPLD结构的优点
CPLD是粗粒结构,这意味著进出器件的路径经过较少的开关,相应地延迟也小。因此,与等效的FPGA相比,CPLD可工作在更高的频率,具有更好的性能。
CPLD的另一个好处是其软件编译快,因为其易于路由的结构使得布放设计任务更加容易执行。
细粒FPGA结构的优点
FPGA是细粒结构,这意味著每个单元间存在细粒延迟。如果将少量的逻辑紧密排列在一起,FPGA的速度相当快。然而,随著设计密度的增加,信号不得不通过许多开关,路由延迟也快速增加,从而削弱了整体性能。CPLD的粗粒结构却能很好地适应这一设计布局的改变。
灵活的输出引脚
CPLD的粗粒结构和时序特性可预测,因此设计人员在设计流程的后期仍可以改变输出引脚,而时序仍保持不变。
为什么CPLD和FPGA需要不同的逻辑设计技巧?
FPGA是细粒器件,其基本单元和路由结构都比CPLD的小。FPGA是“寄存器丰富”型的(即其寄存器与逻辑门的比例高),而CPLD正好相反,它是“逻辑丰富”型的。
很多设计人员偏爱CPLD是因为它简单易用和高速的优点。CPLD更适合逻辑密集型应用,如状态机和地址解码器逻辑等。而FPGA则更适用于CPU和DSP等寄存器密集型设计。
新的CPLD封装
CPLD有多种密度和封装类型,包括单芯片自引导方案。自引导方案在单个封装内集成了FLASH存储器和CPLD,无须外部引导单元,从而可降低设计复杂性并节省板空间。在给定的封装尺寸内,有更高的器件密度共享引脚输出。这就为设计人员提供了“放大”设计的便利,而无须更改板上的引脚输出。
CPLD的功耗
与同样密度的FPGA相比,CPLD的待机功耗更低。
CPLD FPGA (待机电流(在Vcc 为1.8V时))
50K 300μA 200mA
100K 600μA 200mA
200K 1.25mA 300mA
CPLD特别适合那些要求低功耗和低温度的电池供电应用,像手持设备。
许多设计人员都熟悉传统的PLD,并喜欢这种结构所固有的灵活性和易用性。CPLD为ASIC和FPGA设计人员提供了一种很好的替代方案,可让他们以更简单、方便易用的结构实现其设计。CPLD现已达到数十万门的密度,并可提供当今通信设计所需的高性能。大于50万门的设计仍需ASIC和FPGA,但对于小型设计,CPLD不失为一个高性价比的替代方案。
FPGA采用了逻辑单元阵列LCA(Logic Cell Array)这样一个新概念,内部包括可配置逻辑模块CLB(Configurable Logic Block)、输出输入模块IOB(Input Output Block)和内部连线(Interconnect)三个部分。FPGA的基本特点主要有:
1)采用FPGA设计ASIC电路,用户不需要投片生产,就能得到合用的芯片。 ——2)FPGA可做其它全定制或半定制ASIC电路的中试样片。
3)FPGA内部有丰富的触发器和I/O
python -o 是怎么使用的
这是python自己的说明:
-O : optimize generated bytecode slightly
-O 通常是在将py编译为pyo而不是pyc,pyo比pyc小一些所以理论上加载速度会快些(注意是加载速度不是执行速度)。
另外还有一个开关是-OO 这是在-O的基础上再删除去除assert语句和docstring,但是有些模块可能会依赖这些语句,所以要慎用这个开关。
dosbox音乐问题(dos单机游戏),高手进
DOSBox 0.73
新版本的改进是:
DOSBox 0.73 has been released!
Most noticeable changes:
Support for more graphics modes and cards.
支持更多的显示模式和显示卡。
Improved Vista support.
改进的Vista支持。
New OPL emulation cores.
新的OPL(OPL音乐,DOS仙剑用的就是这个)模拟核心。
Sound fixes and improvements for Mac OS X.
为Mac OS X的声音效果进行修补和改进。
Lots of compatibility fixes.
大量兼容性修正。
Lots of cdrom detection improvements.
大量CDROM检测机制的改进。
Lots of memory (EMS/XMS) improvements.
大量对扩展/扩充内存的改进。
Various fixes and enhancements for the recompiling core.
不同程度上对重编译内核的修补和改进(?)。
Support for evdev.
加入对evdev(?)的支持。
Lots of DOS fixes.
大量DOS模拟的修正。
Slightly faster!
速度有所变快。
More stable.
更加稳定。百度地图
如何将一篇中文文章翻译成英文
A smiling face, is a abloom beautiful flower in the spring breeze; A smiling face, is a hank of bright sunlight maping in our heart's ; A smiling face, is a meaningful life poem walking on the way to life.
when successful,people can not help smiling, but when defeated, if on our face is also the pan-graceful happy expression, we are boats evading in the harbor temporarily for the strength saving .
when in favorable circumstances, people smile frequently and happily, but when we suffer setbacks, if on our face is also blooming the calm dimple, we are a treasured sword placing on the burr to whet bide its time of exhibition point .
If we can still show a faint smile when misunderstood by others, this is one kind of accomplishment; If we can still show a confident smile when wronged by others , this is one kind of magnanimous; If we can still show a happy smile when we suffer a loss time ,this is one kind of openness;
if we can still show a self-ridicule smile when we are in predicament time , this is one kind of wisdom; If we can still show a optimistic smile when we have no way to go , this is one kind of boundary; If we can still show a dignified smile when we are in dangerous time ,this is one kind of openmind;If we can still show a tranquil smile when we are laughted at by others, this is one kind of self-confidence; If we can still show a gentle smile when we are meet lovelorn , this is a kind of free and easy.
The reality often beyonds our control , but the mood actually is decided by us, As soon as we open the mouth to smile, life will become infinitly happy!
object c self是什么意思
Object-c中self是获取继承来的属性的获取函数。
self.是访问属性的存取方法。
有关self.的应用的一篇文章:
-------------------------------------------------------------------------------------------
A frequent question I see from people new to iOS programming is why access to an objects instance variables (ivars) sometimes goes via the self object (but not always). For example consider a simple table view controller that contains an NSDate object defined as follows:
对于刚刚开始iOS编程的人来说一个常见的疑问是,为何经常(但不总是)使用self对象访问一个对象实例的变量。例如, 假设有一个简单的table view controller,它包含一个NSDate对象,定义如下:
@interface RootViewController : UITableViewController { NSDate *timestamp; } @property (nonatomic, retain) NSDate *timestamp;
The view controller typically then contains code similar to the following:
view controller的实装代码通常如下:
@implementation RootViewController @synthesize timestamp; - (void)viewDidLoad { [super viewDidLoad]; self.timestamp = [NSDate date]; } - (void)viewWillAppear:(BOOL)animated { self.timestamp = [NSDate date]; [self.tableView reloadData]; } - (void)viewDidUnload { [super viewDidUnload]; self.timestamp = nil; } - (void)dealloc { [timestamp release]; [super dealloc]; }
So why does this code use self.timestamp everywhere except the dealloc method? To understand what is going on you need to understand something about Objective 2.0 properties, accessors and the dot syntax. That is quite a big topic in itself so I will to summarise the key points.
那么为什么这段代码到处使用self.timestamp,但是除了dealloc方法? 要理解怎么回事你需要理解Objective 2.0的properties, accessors和dot语法相关的内容。这个本身是一个比较大的题目,所以我将总结一下要点。
◆Objective-C Properties
The property declaration for the timestamp object is as follows:
属性timestamp的定义如下:
@property (nonatomic, retain) NSDate *timestamp;
The important point to notice is that we have specified retain to indicate that when we set the ivar we should retain the object we are assigning (and of course release any old object we were previously retaining). The implementation of RootViewController includes an @synthesize statement so the compiler will automatically generate getter and setter methods for us that will respect this requirement. Typical getter and setter methods would look like this:
注意重要的一点是,使用retain声明表明了当设置该ivar时,应该retain引用的对象(当然也应该release任何之前retain的老对象)。RootViewController的实现包含了一个@synthesize语句,这样编译器将自动生成getter和setter方法,这将满足这个需求。通常getter和setter方法象下面这样:
- (NSDate *)timestamp { return timestamp; } - (void)setTimestamp:(NSDate *)newValue { if (timestamp != newValue) { [timestamp release]; timestamp = [newValue retain]; } }
The getter is not interesting since it just returns the value of the ivar. The setter method is more interesting since it needs to practise safe memory management. This means whenever we assign a new object we first release the old object and then ensure we retain the new object so that it does not get deallocated before we are finished with it.
getter没有什么有趣的地方,它仅仅返回了该ivar的值。setter方法就有趣多了,因为它需要实现安全的内存管理。这意味着无论何时我们assign一个新对象,首先应该release老对象,然后retain新对象,这样才能确保在我们结束使用之前,它不会被deallocate掉。
To use the setter to store a new NSDate object in our view controller we could write something like this:
要在我们的view controller里使用setter存储一个新的NSDate对象,我们可以象下面这样写:
[self setTimestamp:myNewDate];
This is sending the message setTimestamp to the self object where the self object refers to the RootViewController object. This ends up calling our setter method to safely assign and retain the new object. However there is an alternative to this setter method syntax.
发送setTimestamp消息给self对象,该self包含了对RootViewController对象的引用。它最终调用我们的setter方法来安全地assign和retain新对象。 然而,这儿有一个语句可以替代该setter方法的写法。
◆Objective-C Dot Syntax
The dot syntax was introduced with Objective-C 2.0 and generates a lot of debate. A number of experienced and long time Cocoa programmers recommend avoiding it completely. Others such as Chris Hanson have a different view about when to use properties and dot notation. Whichever side of the argument you fall I guess the main thing is to be consistent.
Objective-C 2.0推出了dot语法,并引起了很多分歧。一些有长时间Cocoa编程经验的人员建议完全避免使用之。其他的例如Chris Hanson则对何时使用properties和dot语法有着不同的看法。不管支持哪一方我猜想最主要的事情都是保持统一。
Anyway the main thing to understand about the dot syntax is that the following two statements are doing the same thing:
无论如何,关于dot语法主要是要理解下面表达式做的事情是一样的:
self.timestamp = [NSDate date]; [self setTimestamp:[NSDate date]];
The dot is just a shortcut for the more traditional Objective-C method call. Any time you see a dot you can replace it with the equivalent square bracket method call syntax. It is important to understand however that this is not the same as writing the following:
这个dot只是一个更传统的Objective-C方法调用的简略写法。任何时候你看到一个dot,你可以使用方括号的方法调用语法来替换它。理解下面的写法与前面是不一样的也是很重要的:
timestamp = [NSDate date];
Without the self object and the dot we are no longer sending an object a message but directly accessing the ivar named timestamp. Since this bypasses the setter method we will overwrite the timestamp ivar without first releasing the old NSDate object. We will also not retain the new object that we are assigning. Both of these situations are bad!
没有了self对象和dot,我们不再是传递一个对象消息而是在直接访问该名为timestamp的ivar了。因为这个跳过了setter方法,我们将覆盖timestamp ivar,并且没有首先releasing老的NSDate对象。同时也没有retain我们引用的新对象。这两种情况都是糟糕的!
◆Putting it all together全部放在一起看
If we walk through each of the view controller methods we saw at the start of this post it should now be clear why each access to timestamp is written the way it is:
如果过一眼篇首的view controller的每个方法,现在应该清楚为什么每个对timestamp的访问需要那么写:
Firstly the viewDidLoad and viewWillAppear methods both allocate a new date object and need to store a reference to this new object in the ivar of the view controller. Since we may already have an existing object allocated this first needs to be released before assigning the new value. In other words we need the setter method which we can invoke using the timestamp property:
首先viewDidLoad和viewWillAppear方法都allocate一个新的date对象,需要存储一个新的对象的参照在view controller的ivar里。因为我们可能已经有一个现存的对象allocated了,所以在分配新的值之前,需要先释放它。换句话说我们需要setter方法来使用timestamp属性:
self.timestamp = [NSDate date];
If we were to omit the self object in the first of those two statements (timestamp = [NSDate date];) we would be accessing the ivar directly which bypasses the setter and ends up leaking memory.
如果我们在开始的那两段里略去了self对象(timestamp = [NSDate date];) 我们将是直接访问该ivar,这种做法绕过了setter,从而引起内存泄漏。
The viewDidUnload method is somewhat different in that it uses a shortcut to both release the NSDate object and then zero the ivar. If you refer back to the setter method you will see that it takes care of the release for us. This is of course true as long as we use the property, if we access the ivar directly we would need to also release the object as follows:
viewDidUnload方法略有不同,它使用了一个缩略写法去既release了NSDate对象又将ivar设置为0。如果你回头看setter方法你会看到它帮我们release了。如果我们使用属性的话这当然很好,如果我们直接访问该ivar我们就还需要象下面这样release对象:
[timestamp release]; timestamp = nil;
which is somewhat longer than simply writing this:
这个比下面这个简单的写法略长了一点:
self.timestamp = nil;
Finally the dealloc method which simply releases the NSDate object needs to access the ivar directly which is what [timestamp release] does.
最后,dealloc方法只是简单地releases NSDate对象,所以需要直接访问该ivar,这也是[timestamp release] 所做的。
★Separating ivars from properties
There is a further option that I think is also worth mentioning at this point. By default when you synthesize the getter and setter accessor methods it is assumed that the property and ivar have the same name. This can make it confusing at first glance as to when you are using the getter/setter methods and when you are accessing the ivar directly. The alternative is name the ivar differently from the property. A common approach is to use an underscore to prefix the ivars names:
这儿有一个进一步的选择我觉得值得提一下。默认情况下,当你synthesize了getter和setter accessor方法,假设属性和ivar有相同的名字。这看上去会比较混乱,搞不清何时你在使用getter/setter方法,何时你是在直接访问ivar。一种方法是给ivars起个与属性不同的名字。最常见的方法是给ivars名加一个下划线前缀:
@interface RootViewController : UITableViewController { NSDate *_timestamp; } @property (nonatomic, retain) NSDate *timestamp;
To connect the property (whose name has not changed) the sythensize statement gets an extra option:
为了连接该属性(它的名字被改变了)sythensize句有一个扩张的选项:
@implementation RootViewController @synthesize timestamp = _timestamp;
If instead of having the compiler automatically synthesize the getter and setter we were to write them ourselves they would now look something like this:
如果不是由编译器自动生成getter和setter,我们自己写的代码就会象下面这样:
- (NSDate *)timestamp { return _timestamp; } - (void)setTimestamp:(NSDate *)newValue { if (_timestamp != newValue) { [_timestamp release]; _timestamp = [newValue retain]; } }
The getter and setter both directly access the ivar which is now much clearer from the use of the _timestamp name. The rest of the code does not change very much since we do mostly want to always use the getter/setter methods with the exception of the dealloc method which needs to access the ivar directly:
getter和setter都直接访问ivar,这看起来就清楚多了。剩下的代码不需要多大改动因为我们基本上总是希望使用getter/setter方法,除了dealloc方法需要直接访问ivar:
- (void)dealloc { [_timestamp release]; [super dealloc]; }
The main advantage to this approach is if you forget and accidentally write something like this:
这种方法的一个主要的好处是如果你忘记或偶尔写了下面的代码:
timestamp = [NSDate date];
This will generate a compiler error telling you that timestamp is undeclared. This is clearly better than directly assigning to the ivar and leaking memory. What I like about this approach is that it provides some additional compile time checking without requiring much in the way of additional code other than a slightly longer synthesize statement for each property.
这将产生一个编译错误告诉你timestamp没有声明。这显然比因直接分配ivar而造成内存泄漏好。我喜欢这种方法是由于它提供了一些附加的编译期检查,而无需许多额外的代码,仅仅使每个属性的synthesize句稍稍长了那么一点点。