河水什么的流着| 长期拉肚子是怎么回事什么原因造成| 小孩睡觉流鼻血是什么原因引起的| 蔻驰包属于什么档次| 做爱什么姿势最舒服| 疝气是什么病怎样治疗| 赵云的武器叫什么| 喝蜂蜜水不能吃什么| 免疫力低下吃什么好| kipper什么意思| 莱特兄弟发明了什么| 大象的耳朵像什么一样| 11月18号是什么星座| 什么掌不能拍| 为什么会内分泌失调| 肛门镜检查能查出什么| 豆蔻是什么| 有口无心是什么意思| 穷凶极恶是什么生肖| 头部出汗多是什么原因| 醒酒最快的方法是什么| 为什么猫怕水| 吃了榴莲不可以吃什么| 婀娜多姿是什么动物| 什么是盆腔炎| 五行水多代表什么| 转氨酶高不能吃什么| 鼻子大的男人说明什么| 梦见煮饭是什么意思| 什么叫细胞| 1979年是什么年| pe和pb是什么意思| 预科班什么意思| 18号来月经什么时候是排卵期| 嘴唇发麻什么病兆| 什么样的人容易得心梗| 一个马一个并念什么| 参加追悼会穿什么衣服| 水瓶座的幸运色是什么颜色| 玄府指的是什么| 爱是什么| 暗网是什么意思| 想做肠镜挂什么科| 为什么叫川普| 低密度脂蛋白偏高吃什么好| 从容不迫什么意思| 湘潭市花是什么| 手心有痣代表什么| 2月30日是什么星座| 十玉九裂是什么意思| 来月经为什么会腰疼| 胎儿脉络丛囊肿是什么原因引起的| 吃什么水果祛斑最快| 826是什么星座| 科颜氏属于什么档次| 监视是什么意思| 为什么脚底会脱皮| 堃是什么意思| 金牛座和什么星座不合| 蝎子泡酒有什么功效| 骨蒸潮热 是什么意思| 身上长肉疙瘩是什么原因| 渝北区有什么好玩的地方| 尿的是白色米汤是什么病| pr间期缩短什么意思| 吃什么记忆力增强| 备孕期间要注意什么| 交叉感染是什么意思| 性生活是什么| 小淋巴结是什么意思| 相声海清是什么意思| 铁蛋白是什么| aep是什么意思| 记忆力减退吃什么药效果好| 椭圆形脸适合什么发型| 九月三号是什么星座| 瞩目是什么意思| 萧敬腾为什么叫雨神| 茶白色是什么颜色| 跳什么舞减肥最快| 阿修罗道是什么意思| 消渴病是什么病| 吃什么水果对嗓子好| 石斛有什么功效| 打鸟是什么意思| 女人什么时候最想男人| 比干是什么神| 荨麻疹要用什么药| 炒什么菜适合拌面| 月经血块多是什么原因| 泳帽的作用是什么| 史字五行属什么| 什么程度算节食减肥| 拔完智齿吃什么食物好| 办护照需要准备什么材料| 碱性磷酸酶偏高说明什么问题| 身份是什么意思| 土的行业有什么工作| 6月22号是什么星座| 咖啡配什么好喝| 给男人补身体煲什么汤| 水瓶是什么象星座| 膝盖里面痛什么原因引起的| 脑脱髓鞘改变是什么病| 飒爽什么意思| 同样的药为什么价格相差很多| 心跳和心率有什么区别| 今日冲什么生肖| 苡米和薏米有什么区别| 兰州大学什么专业最好| 手足口病要注意什么| 形态各异的异是什么意思| 眼睛干涩模糊用什么眼药水| 7月13号是什么星座| 说话口臭是什么原因引起的| 阴盛格阳是什么意思| 气血亏吃什么补的快| 移植后可以吃什么水果| 白天不咳嗽晚上咳嗽吃什么药| amh是什么意思| 重睑术是什么意思| 掉头发补充什么维生素| 血液病有什么症状| 什么然| 喜面是什么意思| 腊八蒜用什么醋比较好| 贫血是什么| 飞机用什么油| 2019年是什么生肖| 心如刀割是什么意思| 长期开灯睡觉有什么危害| 割包皮是什么| 血糖高有什么危害| browser什么意思| 什么红酒好喝| 脑血管痉挛是什么原因引起的| 先天性一个肾对人有什么影响| t恤搭配什么裤子好看| 文昌星是什么意思| 什么食物含维生素c最多| 鸡内金有什么功效| 仁慈是什么意思| 什么睡姿对髋关节好| 玄青色是什么颜色| 吃什么补钾| 舌炎吃什么药好得快| 上腹胀是什么原因| 来月经同房会有什么后果| 便秘是什么原因| 脑血栓适合吃什么水果| 什么烟最贵| 神经衰弱吃什么药最好| 同房有什么好处| 麻是什么面料| 胃胀吃什么药好| 白砂糖是什么糖| 身体缺糖有什么症状| 牙周炎吃什么药好| 油菜是什么菜| 什么是电离辐射| 衣冠禽兽什么意思| 99朵玫瑰花代表什么| 农历2月份是什么星座| 睾丸疼痛什么原因| 洁身自好什么意思| 过期的钙片有什么用途| 富贵包挂什么科| 双乳增生什么意思| 什么叫唐氏综合症| 二尖瓣反流吃什么药| 牛鬼蛇神是什么意思| 属蛇的贵人是什么属相| 同房肚子痛是什么原因| mpv什么意思| 小腹胀胀的是什么原因| 靥是什么意思| 宝宝吐奶是什么原因引起的| 茶苯海明片是什么药| 藤茶有什么功效| 肌红蛋白低说明什么| 勾陈是什么意思| 双肾泥沙样结石是什么意思| 木是什么颜色| 峰值是什么意思| 性生活时间短吃什么药| 左边后背疼是什么原因| 夜不能寐什么意思| glu是什么氨基酸| 孕妇梦见猪是什么意思| 梦见女尸是什么预兆| 冬虫夏草有什么功效与作用| 外阴病变有什么症状| 阴囊积液是什么原因引起的| 什么是肛瘘| 女生掉头发严重是什么原因| 爽字代表什么生肖| 孕妇梦见捡鸡蛋是什么意思| 前纵隔结节是什么意思| 蛋白粉什么时候喝| 有缘无分什么意思| 2019年是什么生肖| 钮钴禄什么意思| 什么是手机号| 什么药治便秘效果最好最快| 养蛊是什么意思| 嘴唇发紫是什么病| 16开是什么意思| 公知是什么意思| ivory是什么意思| 心率偏低会有什么危害| 白敬亭父母是干什么的| 掉头发吃什么恢复最快| 沙棘对肝脏有什么好处| 禹五行属什么| m k是什么牌子| 梦见包丢了是什么意思| 经常吃维生素c有什么好处和坏处| 黄山在什么地方| 梦见自己穿新衣服是什么意思| 小狗需要打什么疫苗| 表现优异是什么意思| 大便常规检查能查出什么| 肺纹理增粗是什么意思| 狗叫是什么意思| cn什么意思| pyq是什么| 七七是什么意思| 老本行是什么意思| 什么叫前列腺炎| 照影是什么意思| 半边脸肿是什么原因| 绝什么意思| 爱新觉罗改成什么姓了| 什么颜色衣服显白| 灵芝长什么样| 人丝是什么面料| 五月二十八是什么日子| 枪代表什么生肖| 桂林有什么好玩的景点| 怀孕了有什么症状| 高血糖吃什么药| 忌口不能吃什么| 北宋六贼为什么没高俅| 女性梅毒有什么症状| 女同是什么| 穿刺检查是什么意思| g6pd筛查是检查什么| 早搏应该吃什么药| 5月3日什么星座| 旗舰店什么意思| 吃什么都咸是什么原因| 急性咽炎吃什么药| 昂热为什么认识路鸣泽| 粘米粉可以做什么好吃的| 甲龙吃什么| 大连机场叫什么| 什么叫心脏早搏| 牙疼有什么好办法| 吃什么药| 准生证有什么用| 肝硬化适合吃什么食物| 紫外线过敏什么症状| 每个月14号都是什么情人节| 真皮是什么皮| 百度





  • A useful feature that is included in the CPU of most computers is a stack or last-in, first-out (UFO) list. A stack is a storage device that stores information in such a manner that the item stored last is the first item retrieved.


  • The stack in digital computers is essentially a memory unit with an address register that can count only (after an initial value is loaded into it).


  • The register that holds the address for the stack is called a stack pointer (SP) because its value always points at the top item in the stack.


  • The two operations of a stack are the insertion and deletion of items. However, nothing is pushed or popped in a computer stack. These operations are simulated by incrementing or decrementing the stack pointer register.


  • Register Stack A stack can be placed in a portion of a large memory or it can be organized as a collection of a finite number of memory words or registers. Figure 3 shows the organization of a 64-word register stack. The stack pointer register SP contains a binary number whose value is equal to the address of the word that is currently on top of the stack. Three items are placed in the stack: A, B, and C, in that order. Item C is on top of the stack so that the content of SP is now 3.


  • Central Processing Unit


  • To remove the top item, the stack is popped by reading the memory word at address 3 and decrementing the content of SP.


  • Item B is now on top of the stack since SP holds address 2. To insert a new item, the stack is pushed by incrementing SP and writing a word in the next-higher location in the stack. Note that item C has been read out but not physically removed.


  • This does not matter because when the stack is pushed, a new item is written in its place. In a 64-word stack, the stack pointer contains 6 bits because 26 = 64.


  • Since SP has only six bits, it cannot exceed a number greater than 63 (111111 in binary). When63 is incrementedby 1, the resultis 0 since 111111 + 1 = 1000000 in binary, but SP can accommodate only the six least significant bits.


  • Similarly, when 000000 is decremented by 1, the result is 111111. The one-bit register FULL is set to 1 when the stack is full, and the one-bit register EMTY is set to 1 when the stack is empty of items. DR is the data register that holds the binary data to be written into or read out of the stack.


  • Initially, SP is cleared to 0, EMTY is set to 1, and FULL is cleared to 0, so that SP points to the word at address 0 and the stack is marked empty and not full. If the stack is not full (if FULL = 0), a new item is inserted with a push operation.


  • The push operation is implemented with the following sequence of microoperations;


  • SP ← SP + 1  Increment stack pointer
    M[SP] ← DR   Write item on top of the stack
    If (SP = 0) then (FULL ←1)  Check if stack is full
    EMTY ← 0   Mark the stack not empty 
    

  • The stack pointer is incremented so that it points to the address of the next-higher word. A memory write operation inserts the word from DR into the top of the stack. Note that SP holds the address of the top of the stack and that M[SP] denotes the memory word specified by the address presently available in SP.


  • The first item stored in the stack is at address L The last item is stored at address 0.


  • If SP reaches 0, the stack is full of items, so FULL is set to L This condition is reached if the top item prior to the last push was in location 63 and, after incrementing SP, the last item is stored in location 0.


  • Once an item is stored in location 0, there are no more empty registers in the stack. If an item is written in the stack, obviously the stack cannot be empty, so EMTY is cleared to 0.


  • A new item is deleted from the stack if the stack is not empty (if EMTY = 0). The pop operation consists of the following sequence of microoperations:


  • DR ← M[SP]  Read item from the top of stack
    SP ← SP - 1  Decrement stack pointer
    If (SP = 0) then (EMTY ← 1)  Check if stack is empty
    FULL ← 0    Mark the stack not full 
    

  • The top item is read from the stack into DR . The stack pointer is then decremented. If its value reaches zero, the stack is empty, so EMTY is set to 1.


  • This condition is reached if the item read was in location 1. Once this item is read out, SP is decremented and reaches the value 0, which is the initial value of SP. Note that if a pop operation reads the item from location 0 and then SP is decremented, SP changes to 111111, which is equivalent to decimal 63.


  • In this configuration, the word in address 0 receives the last item in the stack. Note also that an erroneous operation will result if the stack is pushed when FULL = 1 or popped when EMTY = 1.






  • A stack can exist as a stand-alone unit as in Fig. 3 or can be implemented in a random-access memory attached to a CPU. The implementation of a stack in the CPU is done by assigning a portion of memory to a stack operation and using a processor register as a stack pointer.


  • Figure 4 shows a portion of computer memory partitioned into three segments: program, data, and stack. The program counter PC points at the address of the next instruction in the program. The address register AR points at an array of data.


  • Central Processing Unit


  • The stack pointer SP points at the top of the stack. The three registers are connected to a common address bus, and either one can provide an address for memory.


  • PC is used during the fetch phase to read an instruction. AR is used during the execute phase to read an operand.


  • SP is used to push or pop items into or the stack. As shown in Fig. 4, the initial value of SP is 4001 and the stack grows with decreasing addresses.


  • Thus the first item stored in the stack is at address 4000, the second item is stored at address 3999, and the last address that can be used for the stack Is 3000.


  • No provisions are available for stack limjt checks.


  • We assume that the items in the stack communicate with a data register DR . A new item is inserted with the push operation as follows:


  • SP ← SP - 1
    M[SP] ← DR
    

  • The stack pointer is decremented so that it points at the address of the next word. A memory write operation inserts the word from DR into the top of the stack. A new item is deleted with a pop operation as follows:


  • DR ← M[SP]
    SP ← SP + 1
    

  • The top item is read from the stack into DR. The stack pointer is then incremented to point at the next item in the stack.


  • Most computers do not provide hardware to check for stack overflow (full stack) or underflow (empty stack).


  • The stack limits can be checked by using two processor registers: one to hold the upper limit (3000 in this case), and the other to hold the lower limit (4001 in this case).


  • After a push operation, SP is compared with the upper-limit register and after a pop operation, SP is compared with the lower-limit register.


  • The two microoperations needed for either the push or pop are (1) an access to memory through SP, and (2) updating SP. Which of the two microoperations is done first and whether SP is updated by incrementing or decrementing depends on the organization of the stack.


  • In Fig. 4 the stack grows by decreasing the memory address. The stack may be constructed to grow by increasing the memory address as in Fig. 3.


  • In such a case, SP is incremented for the push operation and decremented for the pop operation. A stack may be constructed so that SP points at the next empty location above the top of the stack.


  • In this case the sequence of microoperations must be interchanged. A stack pointer is loaded with an initial value. This initial value must be the bottom address of an assigned stack in memory. Henceforth, SP is automatically decremented or incremented with every push or pop operation.


  • The advantage of a memory stack is that the CPU can refer to it without having to specify an address, since the address is always available and automatically updated in the stack pointer.






  • A computer will usually have a variety of instruction code formats. It is the function of the control unit within the CPU to interpret each instruction code and provide the necessary control functions needed to process the instruction.


  • The format of an instruction is usually depicted in a rectangular box symbolizing the bits of the instruction as they appear in memory words or in a control register. The bits of the instruction are divided into groups called fields. The most common fields found in instruction formats are:


  • 1. An operation code field that specifies the operation to be performed.
    2. An address field that designates a memory address or a processor
    register.
    3. A mode field that specifies the way the operand or the effective address
    is determined. 
    

  • Other special fields are sometimes employed under certain circumstances, as for example a field that gives the number of shifts in a shift-type instruction. The operation code field of an instruction is a group of bits that define various processor operations, such as add, subtract, complement, and shift.


  • The bits that define the mode field of an instruction code specify a variety of alternatives for choosing the operands from the given address.


  • Operations specified by computer instructions are executed on some data stored in memory or processor registers. Operands residing in memory are specified by their memory address. Operands residing in processor registers are specified with a register address.


  • A register address is a binary number of k bits that defines one of '2k' registers in the CPU. Thus a CPU with 16 processor registers R0 through R15 will have a register address field of four bits.


  • The binary number 0101, for example, will designate register RS. Computers may have instructions of several different lengths containing varying number of addresses. The number of address fields in the instruction format of a computer depends on the internal organization of its registers. Most computers fall into one of three types of CPU organizations:


  • 1. Single accumulator organization.
    2. General register organization.
    3. Stack organization. 
    
    

  • In an accumulator-type organization all operations are performed with an implied accumulator register. The instruction format in this type of computer uses one address field.


  • For example, the instruction that specifies an arithmetic addition is defined by an assembly language instruction as ADD X where X is the address of the operand. The ADD instruction in this case results in the operation AC ← AC + M [X].


  • AC is the accumulator register and M [X] symbolizes the memory word located at address X.


  • In a general register type of organization the instruction format in this type of computer needs three register address fields.


  • Thus the instruction for an arithmetic addition may be written in an assembly language as ADD R1 , R2 , R3 to denote the operation R1 ← R2 + R3.


  • The number of address fields in the instruction can be reduced from three to two if the destination register is the same as one of the source registers.


  • Thus the instruction ADD R1 , R2 would denote the operation R1 ← R1 + R2. Only register addresses for R1 and R2 need be specified in this instruction.


  • Computers with multiple processor registers use the move instruction with a mnemonic MOV to symbolize a transfer instruction. Thus the instruction MOV R1 , R2 denotes the transfer R1 ← R2 (or R2 ← R1, depending on the particular computer).


  • Thus transfer-type instructions need two address fields to specify the source and the destination.


  • General register-type computers employ two or three address fields in






  • Computers with three-address instruction formats can use each address field to specify either a processor register or a memory operand. The program in assembly language that evaluates X = (A + B) * (C + D) is shown below, together with comments that explain the register transfer operation of each instruction.


  • ADD R1, A, B  R1 ← M[A] + M[B]
    ADD R2, C, D  R2 ← M[C] + M[D]
    MOL X, R1, R2  M[X] ← R1 * R2 
    

  • It is assumed that the computer has two processor registers, R1 and R2. The symbol M[A] denotes the operand at memory address symbolized by A.


  • The advantage of the three-address format is that it results in short programs when evaluating arithmetic expressions.


  • The disadvantage is that the binary-coded instructions require too many bits to specify three addresses.






  • Two-address instructions are the most common in commercial computers. Here again each address field can specify either a processor register or a memory word. The program to evaluate X = (A + B) * (C + D) is as follows:


  • MOV R1, A   R1 ← M[A]
    ADD R1, B   R1 ← R1 + M[B]
    MOV R2, C   R2 ← M[C]
    ADD R2, D   R2 ← R2 + M[D]
    MOL R1, R2  R1 ← R1 * R2
    MOV X, R1   M[X] ← R1
    

  • The MOV instruction moves or transfers the operands to and from memory and processor registers.


  • The first symbol listed in an instruction is assumed to be both a source and the destination where the result of the operation is transferred.






  • One-address instructions use an implied accumulator (AC) register for all data manipulation. For multiplication and division there is a need for a second register. However, here we will neglect the second register and assume that the AC contains the result of all operations.


  • The program to evaluate X = (A + B) * (C + D) is


  • LOAD A  AC ← M[AJ
    ADD B   AC ← AC + M[B]
    STORE T  M[T] ← AC
    LOAD  c  AC ← M[C]
    ADD  D   AC ← AC + M[D]
    MOL  T   AC ← AC*M[T]
    STORE  X  M[X] ← AC
    

  • All operations are done between the AC register and a memory operand. T is the address of a temporary memory location required for storing the intermediate result.






  • A stack-organized computer does not use an address field for the instructions ADD and MUL. The PUSH and POP instructions, however, need an address field to specify the operand that communicates with the stack. The following program shows how X = (A + B) * (C + D) will be written for a stack organized computer. (TOS stands for top of stack.)


  • PUSH A TOS ← A 
    PUSH B TOS  ← B 
    ADD TOS ← (A + B) 
    PUSH C TOS ← C 
    PUSH D TOS ← D
    ADD TO S ← (C + D) 
    MOL TOS ← (C + D)*(A + B) 
    POP X M[X] ← TOS 
    

  • To evaluate arithmetic expressions in a stack computer, it is necessary to convert the expression into reverse Polish notation. The name "zero-address" is given to this type of computer because of the absence of an address field in the computational instructions.


Success!
周朝之后是什么朝代 ost是什么 干咳无痰是什么原因引起的 唐氏综合征是什么病 二甲双胍是什么药
三天没有大便是什么原因 医学影像技术是干什么的 没有孕吐反应说明什么 女性阴部痒是什么原因 白细胞低吃什么补得快
清除胃火吃什么药 放纵什么意思 怀孕需要注意什么 什么的水果 三点水一个分读什么
一九六三年属什么生肖 买手是什么职业 有人的地方就有江湖什么意思 东方明珠什么时候亮灯 二尖瓣轻度反流是什么意思
优衣库属于什么档次hcv7jop5ns0r.cn 美容行业五行属什么hcv8jop4ns4r.cn sdeer是什么牌子hcv8jop8ns1r.cn 子宫内膜异位症有什么症状表现helloaicloud.com 驿站什么意思bjhyzcsm.com
什么是窦性心律不齐hcv8jop1ns5r.cn 剑玉是什么hcv9jop7ns2r.cn 盐水泡脚有什么好处hcv9jop7ns5r.cn 伏特加是什么酒hcv8jop3ns7r.cn 火可念什么hcv7jop6ns0r.cn
什么的果实hcv9jop6ns0r.cn 醋纤是什么面料hcv8jop4ns5r.cn 经常恶心干呕是什么原因huizhijixie.com 1992属什么生肖hcv9jop6ns8r.cn 空腹血糖17已经严重到什么时候hcv9jop5ns6r.cn
肝郁化火吃什么中成药hcv8jop3ns9r.cn 女生喜欢什么姿势hcv8jop6ns6r.cn 7.2是什么星座hcv8jop3ns9r.cn 鼻子上的痣有什么寓意hcv8jop7ns4r.cn 弓箭是什么时候发明的hcv9jop4ns0r.cn
百度