《计算机硬件及组装原理cha》由会员分享,可在线阅读,更多相关《计算机硬件及组装原理cha(16页珍藏版)》请在金锄头文库上搜索。
1、Hardware Computer Organization for the Software Professional Arnold S. Berger,1,Memory space of a typical system,Example: Assume a 24-bit addressing range, 16-bit wide data bus 24-bit addressing 16 Mbyte Assume 1 Mbyte of RAM memory, 128KByte of ROM,ROM 64K x 16,0x000000,0x01FFFE,IO Devices,IO Devic
2、es,0xFFFFFE,0xF00000,RAM 512K x 16,Empty Space,Empty Space,Empty Space,Program code and initialization vectors,Stack and heap, variable storage,Hardware Computer Organization for the Software Professional Arnold S. Berger,2,Byte Packing,Word Address,Hardware Computer Organization for the Software Pr
3、ofessional Arnold S. Berger,3,Memory organization (2),Memory organization usually depends upon the width of the processor data bus The 68000 is a 32-bit processor internally, but interfaces to a 16-bit data bus All addresses are 32-bits internally, with 24-bits external (16M),Bit,7,0,0x0000,0xFFFF,0
4、xFFFE,S,T,R,I,N,G,Byte Addressable memory for an 8-bit processor with a 16-bit addressing range,7,0,S,T,R,I,N,G,15,8,Bit,0x00000,0x00001,0xFFFFE,0xFFFFF,Byte Addressable memory for a 16-bit processor with a 20-bit addressing range Intel 80186 Little Endian,7,0,S,T,R,I,N,G,15,8,Bit,0x000001,0x000000,
5、0xFFFFFF,0xFFFFFE,Byte Addressable memory for a 16-bit processor with a 24-bit addressing range MC68000 Big Endian,Hardware Computer Organization for the Software Professional Arnold S. Berger,4,Memory organization,In byte-addressable systems, low-order address bits do the byte addressing Example: T
6、he 68000 has 23 external address lines and can address 224 bytes ( 016,777,215 ) or 223 words ( 08,388,607 ) Address bit A0 is implied by two other signals, UDS and LDS Can be considered to be the byte selector bits for a word addressing system, A1A23 For a 32-bit addressing system and a 32-bit data
7、 path ( long word ) address bits A2A31 ( 01,073,741,823 ) address the word and address bits A0,A1 address the byte of the word,7,0,15,8,23,16,31,24,A0 1 0 1 0 A1 1 1 0 0,Little Endian,7,0,15,8,23,16,31,24,A0 0 1 0 1 A1 0 0 1 1,Big Endian,Hardware Computer Organization for the Software Professional A
8、rnold S. Berger,5,68000 Memory Access,0x000001,0x000000,D15,D8,D7,D0,0x000002,0x000003,0xFFFFFD,0xFFFFFF,0xFFFFFC,0xFFFFFE,A1A23,Lower Data Strobe (LDS),Upper Data Strobe (UDS),Byte Access A0=0: LDS=1, UDS=0 A0=1: UDS=1, LDS=0 Word Access A0=0: LDS=0, UDS=0 A0=1: LDS=1, UDS=1,68000 Processor,Note: A
9、 word access on a byte boundary would require two memory operations to complete and is not allowed in the 68000 processor.,Hardware Computer Organization for the Software Professional Arnold S. Berger,6,Memory organization (4),Storing 32-bit values in a 16-bit external memory,EVEN BYTE ODD BYTE,7 6
10、5 4 2 1 0 7 6 5 4 3 2 1 0,1 LONG WORD = 32 BITS,15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0,LONG WORD 0,MSB,LSB,HIGH ORDER WORD,LOW ORDER WORD,LONG WORD 1,MSB,LSB,LONG WORD 2,MSB,LSB,Hardware Computer Organization for the Software Professional Arnold S. Berger,7,Introduction to Assembly Language,Every com
11、puter system has a fundamental set of operations that it can perform These operations are defined by the instruction set of the processor The instruction set is the atomic element of the processor All the complex operations are achieved by building sequences of these fundamental operations Assembly
12、language is the human readable form of these instructions, called machine language,Instead of writing a program in machine language as: 00000412 307B7048 00000416 327B704A 0000041A 1080 0000041C B010 000041E 67000008 00000422 1600 00000424 61000066 00000428 5248 0000042A B0C9,We write the program in
13、 assembly language as: MOVEA.W (TEST_S,PC,D7),A0 *Well use address indirect MOVEA.W (TEST_E,PC,D7),A1 *Get the end address MOVE.B D0,(A0) *Write the byte CMP.B (A0),D0 *Test it BEQ NEXT_LOCATION *OK, keep going MOVE.B D0,D3 *copy bad data BSR ERROR *Bad byte ADDQ.W #01,A0 *increment the address CMPA
14、.W A1,A0 *are we done?,Hardware Computer Organization for the Software Professional Arnold S. Berger,8,Using labels,Label, a symbolic name given to a variable or a constant Usually refers to a memory address Must be defined in column 1 Labels make the program readable A program may be written without labels, but almost no one ever does it Labels allow the assembler program to automatically calculate addresses Avoids errors in addressing Example, consider the following snippet of code: Question: What does this instruction do? foo BR