Registers are specifiy...

英语翻译Registers are special temporary strage locations within the CPU that very quickly accept,store ,and transfer data and instructions that are being used immediately.The number and types of registers in a computer vary according to the computer's design.The large the registers,the more data the computer can process at one time.Wordsize is used to refer to the size of a register.To get data and instructions moving among the various components of system,the computer needs a data bus.The wider the bus,the more data it can move at one time.The cycle that the computer goes through to fetch and execute one instruction is called the machine cycle.In the instruction cycle part of the machine cycle,an instraction is retrieved from main memory and is decoded in the CPU.The time it takes to do this is called I--time.In the execution cycle ,the instruction is executed and the result is stored.The time this takes is called E-time.An internal clock in the CPU sets the speed of the machine cycle,which is measured in MHz-megahertz,or milions of cycles persecond.A computer system could not operate without main memory,also called internal memory,primary memory,primary storage ,random access memory(RAM),or simply memory.In general,main memory is used to store a copy of the main software program that controls the genneral opera to store a sopy of the business application so to temporarily store data that has been input from the keyboard or other storage device until it is
and to temporarily store data that has been produced as a result of process until it is ready for output or secondary storage.
以下绝对不是机器翻译,是一字一句的手译.我也是学计算机的,已附上部分重要名词的翻译,希望我的翻译令你满意,寄存器(Register)是在中央处理器(CPU)里很特别的临时用来快速储存地址,并且翻译即将被用到的数据(Data)和指令(Instruction)的部件.在一台计算机里面,寄存器的数量和类型根据计算机的设计不同而有所区别.寄存器越大,就能够在同一时间内处理更多的数据.我们用"字长(Wordsize)"来描述一个寄存器的容量.为了让数据和指令放到系统的各个部分里面,计算机需要一个数据总线(DBUS).数据总线越多,就能够在同一时间里调动更多的数据.计算机从获取指令到执行指令,经历这一周的时间叫机器周期.在指令周期里的一些机器周期,一条指令是从主存储器里检索,并且在CPU里译码的.我们把执行这一过程所花的时间叫做"I--Time".在执行周期里,指令被执行并且其结果被保存.我们把执行这一过程所花的时间叫做"E--Time".在CPU里有一个内部时钟来设置机器周期的速度,而衡量机器周期速度是用MHz(兆赫兹)或者百万周/秒.一个计算机系统不能脱离主储存器来操作,它也叫做内存储器,随机存储器(RAM),或者就简称做存储器.一般来说,主存储器用来存放控制计算机常规操作的主要软件程序的复件;去存放一个你正在使用的商务应用软件的复件; 去临时存放从键盘或其它存储设备输入的数据,直到它进入准备处理的阶段; 以及临时存放已经处理的数据结果直到它要准备输出或者要再次存储.
为您推荐:
其他类似问题
扫描下载二维码speciman orientation什么意思_百度知道Mapping memory | Embedded
Mapping memory
Dan_Saks-August 11, 2004
Memory-mapped I/O is something you
can do reasonably well in standard C and C++.
Device drivers communicate with peripheral devices through device registers. A driver sends commands or data to a device by storing into its device register, or retrieves status or data from a device by reading from its device register.
Many processors use memory-mapped I/O, which maps device registers to fixed addresses in the conventional memory space. To a C or C++ programmer, a memory-mapped device register looks very much like an ordinary data object. Programs can use ordinary assignment operators to move values to or from memory-mapped device registers.
Some processors use port-mapped I/O, which maps device registers to locations in a separate address space, typically smaller than the conventional memory space. On these processors, programs must use special machine instructions, such as the in and out instructions of the Intel x86 processors, to move data to or from device registers. To a C programmer, port-mapped device registers don't look quite like ordinary data.
The C and C++ standards are silent about port-mapped I/O. Programs that perform port-mapped I/O must use some nonstandard, platform-specific language or library extensions, or worse, assembly code. On the other hand, memory-mapped I/O is something you can do reasonably well within the standard language dialects.
This month, I'll look at different approaches you can use to refer to memory-mapped device registers.
Device register types
Some device registers migh others may occupy a word or more. In C or C++, the simplest representation for a single device register is as an object of an appropriately sized and signed integer type. For example, you might declare a one-byte register as a char or a two-byte register as an unsigned short.
For example, the ARM Evaluator-7T is a single-board computer with a small assortment of memory-mapped peripheral devices. The board's documentation refers to the device registers as special registers. The special registers span 64KB starting at address 0x03FF0000. The memory is byte-addressable, but each register is a four-byte word aligned to an address that's a multiple of four. You could manipulate each special register as if it were an int or unsigned int. Some programmers prefer to use a type that specifies the physical size of the register more overtly, such as int32_t or uint32_t. (Types such as int32_t and uint32_t are defined in the C99 header <stdint.h>.)
I prefer to use a symbolic type whose name conveys the meaning of the type rather than its physical extent, such as:
typedef unsigned int special_
Special registers are actually volatile entities — they may change state in ways that the compiler can't detect. Therefore, the typedef should be an alias for a volatile-qualified type, as in:
typedef unsigned int volatile special_
Many devices interact through a small collection of device registers, rather than just one. For example, the Evaluator-7T uses five special registers to control the two integrated timers:
TMOD: timer mode register
TDATA0: timer 0 data register
TDATA1: timer 1 data register
TCNT0: timer 0 count register
TCNT1: timer 1 count register
You can represent the timer registers as a struct defined as:
typedef struct dual_timers dual_
struct dual_timers
&&&&special_register TMOD;
&&&&special_register TDATA0;
&&&&special_register TDATA1;
&&&&special_register TCNT0;
&&&&special_register TCNT1;
The typedef before the struct definition elevates the name dual_timers from a mere tag to a full-fledged type name. I'd rather spell TCNT0 as count0, but TCNT0 is the name used throughout the product documentation, so it's probably best not to change it.
In C++, I'd define this struct as a class with appropriate member functions. Whether dual_timers is a C struct or a C++ class doesn't affect the following discussion.
Positioning device registers
Some compilers provide language extensions that will let you position an object at a specified memory address. For example, using the TASKING C166/ST10 C Cross-Compiler's _at attribute you can write a global declaration such as:
unsigned short count _at(0xFF08);
to declare count as a memory-mapped device register residing at address 0xFF08. Other compilers offer #pragma directives to do something similar. However, the _at attribute and #pragma directives are nonstandard. Each compiler with such extensions is likely to support something different.
Standard C and C++ don't let you declare a variable so that it resides at a specified address. The common idiom for accessing a device register is to use a pointer whose value contains the register's address. For example, the timer registers on the Evaluator-7T reside at address 0x03FF6000. A program can access these registers via a pointer that points to that address.
You can define that pointer as a macro, as in:
#define timers ((dual_timers *)0x03FF6000)
or as a constant pointer, as in:
dual_timers *const timers
&nbsp&nbsp&nbsp&= (dual_timers *)0x03FF6000;
Either way you define timers, you can use it to reach the timer registers. For example, the TMOD register contains bits that you can set to enable a timer and clear to disable a timer. You can define the masks for those bits as enumeration constants:
enum { TE0 = 0x01, TE1 = 0x08 };
Then you can disable both timers using:
timers->TMOD &= ~(TE0 | TE1);
Weighing the alternatives
These two pointer definitions—the macro and the constant object—are largely interchangeable. However, they produce slightly different behavior and, on some platforms, generate slightly different machine code.
As I explained in an earlier column, the macro preprocessor is a distinct compilation phase. The preprocessor does macro substitution before the compiler does any other symbol processing. For example, given the macro definition for timers, the preprocessor transforms:
timers->TMOD &= ~(TE0 | TE1);
((dual_timers *)0x03FF6000)->TMOD
&nbsp&nbsp&nbsp&&= ~(TE0 | TE1);
Later compilation phases never see the macro symbol timers; they see only the source text after macro substitution.
Many compilers don't pass macro names on to their debuggers, in which case macro names are invisible to the debugger.
Macros have an even more serious problem: macro names don't observe the scope rules that apply to other names. For example, you can't restrict a macro to a local scope. Defining a macro within a function, as in:
void timer_handler()
&nbsp&nbsp&nbsp&{
&nbsp&nbsp&nbsp&#define timers ((dual_timers *)0x03FF6000)
&nbsp&nbsp&nbsp& ...
&nbsp&nbsp&nbsp&}
doesn't make the macro local to the function. The macro is still effectively global. Similarly, you can't declare a macro as a member of a C++ class or namespace.
Actually, macro names are worse than global names. Names declared in inner scopes can temporarily hide names from outer scopes, but they can't hide macro names. Consequently, macros might substitute in places where you don't expect them to.
Declaring timers as a constant pointer avoids both of these problems. The name should be visible in your debugger, and if you declare it in a nonglobal scope, it should stay there.
On the other hand, with some compilers on some platforms, declaring timers as a constant pointer might—I emphasize might—produce slightly slower and larger code. The compiler might produce different code if you define the pointer globally or locally. It might produce different code if you compile the definition in C as opposed to C++. I'll explain what the differences are and why they occur in my next column.
Dan Saks Saks is president of Saks & Associates, a C/C++ training and consulting company. You can write to him at .
Barr, Michael, ", . January 2004.
Saks, Dan, "," Embedded Systems Programming, September 2002, p. 7.
Saks, Dan, "," Embedded Systems Programming, November 2001, p. 55.
Most Commented
Related Content
| Discussion
| Discussion
| Discussion
| Discussion
Parts Search
185 Million Searchable Parts
Sponsored Blogs
Subscribe to RSS updates
Development Centers
Essentials & Education
UBM Communities
Working With Us:}

我要回帖

更多关于 registers 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信