郎酒是什么香型| afc是什么意思| 7月31号是什么星座| 什么学习机好| 龟头炎有什么症状| 杀鸡取卵是什么生肖| 女人取环什么时候最好| 解酒吃什么药| 渡人是什么意思| 高血脂会引起什么疾病| 喉咙痛是什么原因| 血管脆是什么原因| 精子成活率低吃什么药| 夏天什么面料最凉快| 什么颜色衣服显皮肤白| 什么是巧克力囊肿| 协警是什么编制| 手的皮肤黄是什么原因| 次长是什么职位| 咽喉炎用什么药| 什么是安全| 脂肪垫是什么| 一幅什么| 玉米不能和什么食物一起吃| 一般事故隐患是指什么| 草果是什么| 伊丽莎白雅顿什么档次| 一九七八年属什么生肖| 一直打嗝什么原因| 耳垂后面疼是什么原因| 两女一杯什么意思| 怀孕第一个月有什么特征| 宽字五行属什么| 梦见打人是什么意思| 女儿取什么名字好听| 肚脐眼下面痛什么原因| 天麻与什么煲汤最好| 女性性高潮是什么感觉| 紧急避孕药什么时候吃有效| 身上带什么可以辟邪| 糖尿病病人吃什么水果| 吃什么可以软化肝脏| 1月17号是什么星座| 什么的植物| cnc是什么牌子| 碗摔碎了预示着什么| 长期失眠吃什么食物好| 多喝柠檬水有什么好处| 胆汁酸高吃什么药| 身体寒湿重吃什么好| 香蕉和什么一起吃能减肥| 杳冥是什么意思| her2是什么意思| 沉鱼落雁闭月羞花是什么意思| 96615是什么电话| 水鸭跟什么煲汤最佳| 儿童贫血吃什么补血最快| 崩溃是什么意思| 肺大泡吃什么药| 鼻窦炎都有什么症状| 心肌炎是什么症状| 闪回是什么意思| 龙年是什么年| 世界上最大的沙漠是什么沙漠| 鼻塞一直不好什么原因| 拉肚子为什么肛门痛| 晚上十点多是什么时辰| 小巴西龟吃什么食物| 查血糖是什么检查项目| 鼻翼长痘是什么原因| 老人手抖是什么病的预兆| 牙齿咬不动东西是什么原因| 狗的尾巴有什么作用| 什么叫全日制本科| 辣木籽主治什么病| 累觉不爱是什么意思| saq是什么意思| 吃桃子有什么好处| 文竹的寓意是什么| 腋毛癣用什么药膏最好| 乌龟不吃食是什么原因| 白细胞酯酶弱阳性什么意思| 祛湿有什么好处| 牙膏尾部的颜色代表什么意思| ket是什么意思| 肌红蛋白是什么意思| 什么是脑梗| ag医学上是什么意思| 宝宝吃什么鱼比较好| 王不见王是什么意思| 鹦鹉拉肚子吃什么药| 男生下面疼是什么原因| 桉是什么意思| 喉咙有痰是什么原因引起的| 乙肝两对半阴性是什么意思| 山宗读什么| 男孩什么时候开始发育| 清宫和人流有什么区别| 飞字五行属什么| 总是掉头发是什么原因| 窦性心律过速吃什么药| 脾大对身体有什么影响| 缺维生素e有什么症状| 电影下映是什么意思| 什么医院才是正规医院| 愤是什么生肖| 女人要矜持是什么意思| 59岁属什么| 肌无力挂什么科| 饭前饭后吃药有什么区别| 中指尖麻木是什么原因| 耳朵痒痒是什么原因| 晚上老咳嗽是什么原因| 赤潮是什么意思| 女生肾虚是什么原因| 男孩过生日送什么礼物好| 满清十大酷刑是什么| 什么颜色属木| 喉炎雾化用什么药| 枸杞子有什么功效| 六月十四是什么星座| 什么叫皈依| 妨夫痣是什么意思| 拮抗药物是什么药| 什么是遗憾| 丙氨酸氨基转移酶高是什么意思| 吃什么对牙齿好| 痰多吃什么化痰| 同房后小腹疼痛是什么原因| 3月25号是什么星座| 农历11月11日是什么星座| 螃蟹为什么吐泡泡| 降肝火喝什么茶| 葡萄胎有什么症状反应| 脱肛是什么原因造成的| 猪朋狗友是什么意思| 小黄人是什么意思| 马步鱼为什么是甜的| 11月9号是什么星座| 96年的属什么| 天上的彩虹像什么| 什么是烂尾楼| 为什么放屁多| pangchi是什么牌子的手表| 为什么我的眼里常含泪水| 女性尿频尿急是什么原因| 为什么脸上总是出油| 三甲医院是什么意思| 座驾是什么意思| 为什么会缺铁性贫血| 什么猫掉毛少| tt是什么| 看乳腺应该挂什么科| 月经一直不停有什么办法止血| 肝囊肿是什么原因引起的| 脑震荡后眩晕吃什么药| 爱马仕配货是什么意思| 美仑美奂什么意思| 什么满天下| 头疼检查什么项目| mrcp检查是什么意思| 看月经挂什么科| karcher是什么牌子| 中国第一艘航空母舰叫什么| 取其轻前一句是什么| 胃疼吃点什么药| 布病是什么| 脚后跟痛是什么问题| inr是什么意思| 喉咙痛感冒吃什么药| 为什么叫关东军| 广谱是什么意思| 牛肉配什么菜包饺子好吃| 12580是什么号码| 乙类药品是什么意思| 增强免疫力的针叫什么| 炸粉是什么粉| 俗气是什么意思| 什么东西蛋白质最高| 蜻蜓是什么目| 足底筋膜炎挂什么科| 耳朵嗡嗡的响是什么原因| 心衰竭是什么病| 扁平疣用什么药膏管用| 痛风可以吃什么肉| 元气是什么| 下头是什么意思| 梦到下雪是什么意思| 梦见抓鸟是什么征兆| 花枝是什么食材| 手背出汗是什么原因| 风湿病是什么引起的| 4.28什么星座| 甘霖是什么意思| 九月三号是什么星座| 什么肥什么壮| 硅胶是什么材质| 松子是什么树的果实| 脸油油的是什么原因| 飞机下降时耳朵疼是什么原因| 烟酰胺是什么| 梦见给别人剪头发是什么意思| 心脏下边是什么器官| 蛇缠腰是什么病怎么治| 藏红花泡水是什么颜色| 大圣归来2什么时候上映| 圆脸适合什么发型女| 混合痔是什么意思| barry是什么意思| 徐州菜属于什么菜系| 蒂芙尼蓝是什么颜色| 31年属什么生肖| 凤尾鱼为什么突然就死| 冰箱什么牌子的好| 窦道是什么意思| 壮字五行属什么| 8月25号是什么日子| 皮肤长小肉粒是什么原因| 归元寺求什么最灵验| 血糖高初期有什么症状| 白细胞低是什么原因| 青鹏软膏主要治疗什么| 铎读什么| 石青色是什么颜色| 小叶苦丁茶有什么作用和功效| 葡式蛋挞为什么叫葡式| 女人吃维生素b有什么好处| 睡眠不好什么原因| 利多卡因是什么药| 老鸭汤炖什么好吃| 羽立念什么| 脾虚吃什么| 起付线是什么意思| 背疼应该挂什么科| 膀胱结石是什么症状| 补办身份证需要什么手续| 胎儿打嗝是什么原因| 2017年属鸡火命缺什么| 96199是什么电话| jio是什么意思| 喝什么茶养肝护肝最好| 胸部有硬块挂什么科| moss是什么意思| 朝拜的意思是什么| 情人果是什么| 胸上长痘痘是什么原因| 以梦为马是什么意思| 择期手术是什么意思| bl是什么单位| 感统训练是什么| 办理结婚证需要什么材料| 什么是炎症| 吞咽困难是什么感觉| fl是什么| 父母都是o型血孩子是什么血型| 血糖高适合吃什么蔬菜| 什么是品质| hpv58阳性是什么意思| 经常头晕是什么原因| 中药和中成药有什么区别| 今年50岁属什么| 梦见大便是什么预兆| 梦见狗追我是什么意思| 蒟蒻是什么东西| 百度





  • 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!
楚乔传2什么时候上映 什么是眩晕症 2月17日是什么星座 妯娌关系是什么意思 五险都有什么险
慢阻肺是什么病 水猴子是什么动物 喜欢吃什么 心肌供血不足吃什么 肝病初期有什么症状
手癣是什么原因引起的 双性恋是什么 属龙跟什么属相最配 白带异味是什么原因 拔罐是什么原理
坐久了脚肿是什么原因 吃什么都是苦的是怎么回事 cv是什么 羊眼圈是什么 什么是浸润性乳腺癌
滴虫性阴道炎用什么药好hcv8jop6ns0r.cn 什么药补血最快hcv8jop1ns7r.cn 羊水穿刺是检查什么hcv8jop9ns1r.cn u型枕有什么作用hcv7jop6ns0r.cn 于谦为什么加入国民党hcv7jop6ns4r.cn
三生三世是什么意思jinxinzhichuang.com 什么是g点hcv9jop4ns5r.cn 哺乳期头痛可以吃什么药hcv9jop1ns1r.cn 人见人爱是什么意思hcv9jop1ns5r.cn 新生儿黄疸高是什么原因hcv8jop6ns2r.cn
婴儿拉肚子吃什么药hcv9jop2ns0r.cn 症结是什么意思hcv7jop6ns5r.cn 梦见手指流血是什么预兆hcv9jop4ns0r.cn 肝钙化灶是什么意思hcv8jop7ns7r.cn 什么牌的笔记本电脑好hcv7jop5ns2r.cn
松鼠是什么生肖hcv7jop9ns8r.cn 动物的脖子有什么作用hcv9jop4ns1r.cn 不良反应是什么意思gangsutong.com 头晕拉肚子是什么情况hcv8jop0ns5r.cn 金的部首是什么hcv8jop7ns0r.cn
百度