To understand how a microprocessor works, it is helpful to look inside and learn about the logic used to create one. In the process you can also learn about assembly language -- the native language of a microprocessor -- and many of the things that engineers can do to boost the speed of a processor.
A microprocessor executes a collection of machine instructions that tell the processor what to do. Based on the instructions, a microprocessor does three basic things:
• Using its ALU (Arithmetic/Logic Unit), a microprocessor can perform mathematical operations like addition, subtraction, multiplication and division. Modern microprocessors contain complete floating point processors that can perform extremely sophisticated operations on large floating point numbers.
• A microprocessor can move data from one memory location to another.
• A microprocessor can make decisions and jump to a new set of instructions based on those decisions.
There may be very sophisticated things that a microprocessor does, but those are its three basic activities. The following diagram shows an extremely simple microprocessor capable of doing those three things: This is about as simple as a microprocessor gets. This microprocessor has:
• An address bus (that may be 8, 16 or 32 bits wide) that sends an address to memory
• A data bus (that may be 8, 16 or 32 bits wide) that can send data to memory or receive data from memory
• An RD (read) and WR (write) line to tell the memory whether it wants to set or get the addressed location
• A clock line that lets a clock pulse sequence the processor
• A reset line that resets the program counter to zero (or whatever) and restarts execution
Let's assume that both the address and data buses are 8 bits wide in this example.
Here are the components of this simple microprocessor:
• Registers A, B and C are simply latches made out of flip-flops. (See the section on "edge-triggered latches" in How Boolean Logic Works for details.)
• The address latch is just like registers A, B and C.
• The program counter is a latch with the extra ability to increment by 1 when told to do so, and also to reset to zero when told to do so.
• The ALU could be as simple as an 8-bit adder (see the section on adders in How Boolean Logic Worksfor details), or it might be able to add, subtract, multiply and divide 8-bit values. Let's assume the latter here.
• The test register is a special latch that can hold values from comparisons performed in the ALU. An ALU can normally compare two numbers and determine if they are equal, if one is greater than the other, etc. The test register can also normally hold a carry bit from the last stage of the adder. It stores these values in flip-flops and then the instruction decoder can use the values to make decisions.
• There are six boxes marked "3-State" in the diagram. These are tri-state buffers. A tri-state buffer can pass a 1, a 0 or it can essentially disconnect its output (imagine a switch that totally disconnects the output line from the wire that the output is heading toward). A tri-state buffer allows multiple outputs to connect to a wire, but only one of them to actually drive a 1 or a 0 onto the line.
• The instruction register and instruction decoder are responsible for controlling all of the other components.
Although they are not shown in this diagram, there would be control lines from the instruction decoder that would:
• Tell the A register to latch the value currently on the data bus
• Tell the B register to latch the value currently on the data bus
• Tell the C register to latch the value currently output by the ALU
• Tell the program counter register to latch the value currently on the data bus
• Tell the address register to latch the value currently on the data bus
• Tell the instruction register to latch the value currently on the data bus
• Tell the program counter to increment
• Tell the program counter to reset to zero
• Activate any of the six tri-state buffers (six separate lines)
• Tell the ALU what operation to perform
• Tell the test register to latch the ALU's test bits
• Activate the RD line
• Activate the WR line
Coming into the instruction decoder are the bits from the test register and the clock line, as well as the bits from the instruction register.
เข้าใจวิธีการทำงานของหน่วยประมวลผล จะเป็นประโยชน์เพื่อดูภายใน และเรียนรู้เกี่ยวกับตรรกะที่ใช้ในการสร้างหนึ่ง ในกระบวนการ คุณยังสามารถเรียนรู้เกี่ยวกับแอสเซมบลีภาษา -ภาษาพื้นเมืองของหน่วยประมวลผล - และหลายสิ่งที่วิศวกรต้องทำเพื่อเพิ่มความเร็วของตัวประมวลผลหน่วยประมวลผลดำเนินการชุดของคำสั่งเครื่องที่บอกตัวประมวลผลจะทำอย่างไร หน่วยประมวลผลตามคำแนะนำ ไม่สามสิ่งพื้นฐาน:•การใช้การเสริมอะลูมิเนียม (หน่วยเลขคณิต/ตรรกะ), หน่วยประมวลผลสามารถดำเนินการทางคณิตศาสตร์เช่นการบวก การลบ การคูณ และการหาร ประมวลทันสมัยประกอบด้วยจุดลอยตัวที่สมบูรณ์ตัวประมวลผลที่สามารถทำได้อย่างมากในจำนวนจุดลอยตัวขนาดใหญ่ที่ทันสมัย•หน่วยประมวลผลสามารถย้ายข้อมูลจากหน่วยความจำหนึ่งไปยังอีกไมโครโปรเซสเซอร์• A สามารถตัดสินใจ และชุดใหม่คำแนะนำตามที่ตัดสินใจกระโดดอาจมีสิ่งที่หน่วยประมวลผลไม่ซับซ้อนมาก แต่ที่เป็นกิจกรรมพื้นฐานของสาม แผนภาพแสดงการประมวลผลง่ายมากสามารถทำสิ่งเหล่านั้นสาม: โดยประมาณเป็นง่ายเช่นหน่วยประมวลผลที่ได้รับการ ไมโครโพรเซสเซอร์นี้มี:•อยู่ขนส่ง (ที่อาจเป็น 8, 16 หรือ 32 บิตกว้าง) ที่ส่งอยู่หน่วยความจำ• A ข้อมูลรถ (ที่อาจเป็น 8, 16 หรือ 32 บิตกว้าง) ที่สามารถส่งข้อมูลไปยังหน่วยความจำ หรือรับข้อมูลจากหน่วยความจำ•การ RD (อ่าน) และเกิดจาก (เขียน) เส้นบอกหน่วยความจำว่าจะต้อง ไปตั้งรับที่ตั้งอยู่•เส้นตอกที่ชีพจรนาฬิกาลำดับการประมวลผล• A บรรทัดที่รีเซ็ตโปรแกรมเคาน์เตอร์เก็บศูนย์ (หรืออะไรก็ตาม) และเริ่มดำเนินการ ใหม่สมมติว่า รถที่อยู่และข้อมูล 8 บิตที่กว้างในตัวอย่างนี้นี่คือส่วนประกอบของหน่วยประมวลผลอย่างนี้:•ทะเบียน A, B และ C มีแค่กลอนประตูที่ทำจากคอฟฟี่ช็อป (ดูส่วน "ทริกเกอร์ขอบกลอนประตู" ในวิธี Boolean ตรรกะการทำงานสำหรับรายละเอียด)•สลักอยู่เป็นเหมือนลงทะเบียน A, B และ c•เคาน์เตอร์โปรแกรมสลักสามารถเสริมเพิ่ม 1 เมื่อบอกดัง และ การตั้งค่าเป็นศูนย์เมื่อบอกให้ทำเช่นนั้นได้•การเสริมอะลูมิเนียมอาจเป็นง่าย ๆ เป็นวงจรบวกเป็น 8 บิต (ดูส่วนบน adders ในรายละเอียดว่า Boolean ตรรกะ Worksfor), หรืออาจจะสามารถเพิ่ม ลบ คูณ และหารค่า 8 บิตได้ สมมตินี่หลัง•การลงทะเบียนทดสอบเป็นสลักพิเศษที่สามารถเก็บค่าจากการเปรียบเทียบที่ดำเนินการในการเสริมอะลูมิเนียม เสริมอะลูมิเนียมสามารถเปรียบเทียบเลขสองปกติ และกำหนดว่า พวกเขามีการเท่ากัน ถ้ามีขนาดใหญ่กว่าอื่น ฯลฯ การลงทะเบียนทดสอบปกติยังสามารถเก็บบิตดำเนินการจากขั้นตอนสุดท้ายของวงจรบวกที่ จะเก็บค่าเหล่านี้ในคอฟฟี่ช็อป และตัวถอดรหัสคำสั่งสามารถใช้ค่าการตัดสินใจ•มี 6 กล่องทำเครื่องหมาย "3 สถานะ" ในไดอะแกรม ได้แก่รัฐตรีบัฟเฟอร์ ตรีรัฐบัฟเฟอร์สามารถผ่าน 1, 0 หรือสามารถเป็นยกของผลผลิต (สลับที่ทั้งหมดยกเลิกติดต่อการลวดที่ออกเป็นหัวข้อไป คิด) ตรีรัฐบัฟเฟอร์ช่วยให้แสดงผลหลายการเชื่อมต่อกับลวด แต่เดียวเท่านั้นจริง ขับ 1 หรือ 0 ลงในบรรทัด•ถอดรหัสลงทะเบียนและคำสั่งสอนรับผิดชอบในการควบคุมส่วนประกอบอื่น ๆ ทั้งหมดถึงแม้ว่าพวกเขาจะไม่แสดงในแผนภาพนี้ จะมีบรรทัดควบคุมจากตัวถอดรหัสคำสั่งที่จะ:•แจ้งการลงทะเบียน A การแลตช์ค่าอยู่บนบัสข้อมูล•แจ้งการลงทะเบียน B การแลตช์ค่าอยู่บนบัสข้อมูล•แจ้งทะเบียน C การแลตช์ค่าออกกำลัง โดยการเสริมอะลูมิเนียม•แจ้งการลงทะเบียนเคาน์เตอร์โปรแกรมการแลตช์ค่าอยู่บนบัสข้อมูล•แจ้งการลงทะเบียนที่อยู่การแลตช์ค่าอยู่บนบัสข้อมูล•แจ้งการลงทะเบียนคำสั่งการแลตช์ค่าอยู่บนบัสข้อมูล•แจ้งเคาน์เตอร์โปรแกรมการเพิ่ม•แจ้งเคาน์เตอร์โปรแกรมการตั้งค่าเป็นศูนย์•เรียกใช้ใด ๆ ของบัฟเฟอร์ตรีรัฐหก (หกต่างหาก)•แจ้งการเสริมอะลูมิเนียมใดดำเนินการ•แจ้งการลงทะเบียนทดสอบการแลตช์ของเสริมอะลูมิเนียมทดสอบบิต•เรียกใช้บรรทัดการ RD•เรียกใช้บรรทัดการเกิดจากมาเป็นตัวถอดรหัสคำสั่งมีบิตจากการลงทะเบียนทดสอบ และสายนาฬิกา และบิตจากการลงทะเบียนคำสั่ง
การแปล กรุณารอสักครู่..

เพื่อให้เข้าใจถึงวิธีการที่ไมโครโปรเซสเซอร์ทำงานก็จะเป็นประโยชน์ที่จะมองภายในและเรียนรู้เกี่ยวกับตรรกะที่ใช้ในการสร้าง ในขั้นตอนนี้คุณยังสามารถเรียนรู้เกี่ยวกับภาษาประกอบ - ภาษาพื้นเมืองของไมโครโปรเซสเซอร์ -. และอีกหลายสิ่งที่วิศวกรสามารถทำได้เพื่อเพิ่มความเร็วในการประมวลผล
ไมโครโปรเซสเซอร์ดำเนินการชุดของคำสั่งที่บอกให้เครื่องประมวลผลสิ่งที่ ที่จะทำ ขึ้นอยู่กับคำแนะนำของไมโครโปรเซสเซอร์ไม่สามสิ่งพื้นฐาน:
•การใช้ของ ALU (Arithmetic / ลอจิกหน่วย), ไมโครโปรเซสเซอร์สามารถดำเนินการทางคณิตศาสตร์เช่นบวกลบคูณและหาร ไมโครโปรเซสเซอร์ที่ทันสมัยมีจุดลอยที่สมบูรณ์ที่สามารถดำเนินการที่มีความซับซ้อนมากที่หมายเลขจุดลอยขนาดใหญ่.
•ไมโครโปรเซสเซอร์สามารถย้ายข้อมูลจากหน่วยความจำตำแหน่งหนึ่งไปยังอีก.
•ไมโครโปรเซสเซอร์สามารถตัดสินใจและข้ามไปยังชุดใหม่ของคำแนะนำขึ้นอยู่กับการตัดสินใจเหล่านั้น .
อาจจะมีสิ่งที่มีความซับซ้อนมากที่ไมโครโปรเซสเซอร์ไม่ แต่ผู้ที่มีสามกิจกรรมพื้นฐานของ แผนภาพต่อไปนี้แสดงให้เห็นว่าไมโครโปรเซสเซอร์ง่ายมากที่มีความสามารถในการทำสิ่งเหล่านั้นที่สาม: เรื่องนี้เป็นเรื่องง่ายๆเป็นไมโครโปรเซสเซอร์ได้รับ ไมโครโปรเซสเซอร์นี้:
•รถที่อยู่ (ที่อาจจะ 8, 16 หรือ 32 บิตกว้าง) ที่ส่งที่อยู่ในหน่วยความจำ
•บัสข้อมูล (ที่อาจจะ 8, 16 หรือ 32 บิตกว้าง) ที่สามารถส่งข้อมูลไปยังหน่วยความจำหรือได้รับ ข้อมูลจากหน่วยความจำ
• RD (อ่าน) และ WR (เขียน) สายที่จะบอกหน่วยความจำไม่ว่าจะต้องการที่จะตั้งหรือได้รับตำแหน่งที่
•สายนาฬิกาที่ช่วยให้การเต้นของชีพจรลำดับนาฬิกาโปรเซสเซอร์
•สายการตั้งค่าที่ตั้งค่าโปรแกรมเคาน์เตอร์ เป็นศูนย์ (หรืออะไรก็ตาม) และเริ่มต้นใหม่ดำเนินการ
. สมมติว่าทั้งที่อยู่และข้อมูลรถโดยสาร 8 บิตกว้างในตัวอย่างนี้
นี่คือองค์ประกอบของไมโครโปรเซสเซอร์ง่ายๆนี้คือ:
• Registers, B และ C จะเป็นเพียงการสลักที่ทำจาก flip- flops (ดูในส่วนที่ "สลักขอบเรียก" ในการทำงานแบบบูลลอจิกวิธีสำหรับรายละเอียด.)
•สลักอยู่ก็เหมือนกับการลงทะเบียน A, B และ C
•โปรแกรมเคาน์เตอร์เป็นสลักที่มีความสามารถพิเศษที่จะเพิ่มขึ้น 1 เมื่อ บอกว่าจะทำเช่นนั้นและยังตั้งค่าให้เป็นศูนย์เมื่อบอกให้ทำเช่นนั้น.
• ALU อาจจะเป็นง่ายๆเป็นบวก 8 บิต (ดูส่วนที่เกี่ยวกับงูในรายละเอียดวิธีการบูลีนลอจิก Worksfor) หรือมันอาจจะเป็นความสามารถในการ บวกลบคูณและหารค่า 8 บิต สมมติว่าหลังที่นี่.
•ลงทะเบียนทดสอบเป็นสลักพิเศษที่สามารถเก็บค่าจากการเปรียบเทียบการดำเนินการใน ALU ALU ปกติสามารถเปรียบเทียบตัวเลขสองและตรวจสอบว่าพวกเขามีค่าเท่ากันหากมีมากขึ้นกว่าที่อื่น ๆ ฯลฯ การทดสอบยังสามารถลงทะเบียนได้ตามปกติถือพกบิตจากขั้นตอนสุดท้ายของการบวก มันเก็บค่าเหล่านี้ในรองเท้าแตะแล้วถอดรหัสคำสั่งที่สามารถใช้ค่าที่จะทำให้การตัดสินใจ.
•มีหกกล่องมีเครื่องหมาย "3-State" ในแผนภาพ เหล่านี้เป็นบัฟเฟอร์รัฐ tri บัฟเฟอร์รัฐ tri สามารถผ่าน 1, 0 หรือเป็นหลักสามารถตัดการเชื่อมต่อเอาท์พุท (จินตนาการสวิทช์ที่ทั้งหมดยกเลิกการเชื่อมต่อสายออกจากสายว่าการส่งออกจะมุ่งหน้าไปยัง) บัฟเฟอร์รัฐ tri ช่วยให้ผลหลายเพื่อเชื่อมต่อกับลวด แต่เพียงหนึ่งของพวกเขาที่จะเป็นจริงขับรถ 1 หรือ 0 บนเส้น.
•ลงทะเบียนเรียนการสอนและการเรียนการสอนถอดรหัสมีความรับผิดชอบในการควบคุมทุกองค์ประกอบอื่น ๆ .
แม้ว่าพวกเขา จะไม่แสดงในแผนภาพนี้จะมีสายการควบคุมถอดรหัสจากการเรียนการสอนที่จะ:
•บอกลงทะเบียนเพื่อสลักมูลค่าปัจจุบันบนรถบัสข้อมูล
•บอก B ลงทะเบียนเพื่อสลักมูลค่าปัจจุบันบนรถบัสข้อมูล
•บอก C ลงทะเบียนเพื่อสลักมูลค่าการส่งออกในขณะนี้โดย ALU
•บอกโปรแกรมที่เคาน์เตอร์ลงทะเบียนเพื่อสลักมูลค่าปัจจุบันบนรถบัสข้อมูล
•บอกลงทะเบียนที่อยู่ในการสลักมูลค่าปัจจุบันบนรถบัสข้อมูล
•บอกการเรียนการสอนการลงทะเบียนเพื่อสลักมูลค่าปัจจุบัน บนรถบัสข้อมูล
•บอกโปรแกรมเคาน์เตอร์เพื่อเพิ่ม
•บอกโปรแกรมเคาน์เตอร์ที่จะตั้งค่าให้เป็นศูนย์
•เปิดใช้งานใด ๆ ของหกบัฟเฟอร์รัฐ tri (หกบรรทัดที่แยกต่างหาก)
•บอก ALU สิ่งที่ดำเนินการในการดำเนินการ
•บอกทดสอบลงทะเบียนเพื่อสลัก ALU บิตของการทดสอบ
•เปิดใช้งานสาย RD
•เปิดใช้งานสาย WR
เข้ามาในตัวถอดรหัสการเรียนการสอนที่มีบิตจากการลงทะเบียนการทดสอบและสายนาฬิกาเช่นเดียวกับบิตจากการเรียนการสอนการลงทะเบียน
การแปล กรุณารอสักครู่..

เข้าใจว่าไมโครโปรเซสเซอร์ทำงาน มันเป็นประโยชน์เพื่อดูข้างใน และเรียนรู้เกี่ยวกับตรรกะที่ใช้ในการสร้างหนึ่ง ในกระบวนการนอกจากนี้คุณยังสามารถเรียนรู้เกี่ยวกับภาษาประกอบ -- ภาษาพื้นเมืองของไมโครโปรเซสเซอร์ และหลายสิ่งที่วิศวกรสามารถทำเพื่อเพิ่มความเร็วในการประมวลผล .
ไมโครโปรเซสเซอร์รันคอลเลกชันของคำสั่งเครื่องที่บอกหน่วยประมวลผลจะทำยังไง Based on the instructions, a microprocessor does three basic things:
• Using its ALU (Arithmetic/Logic Unit), a microprocessor can perform mathematical operations like addition, subtraction, multiplication and division. Modern microprocessors contain complete floating point processors that can perform extremely sophisticated operations on large floating point numbers.
• A microprocessor can move data from one memory location to another.
• A microprocessor can make decisions and jump to a new set of instructions based on those decisions.
There may be very sophisticated things that a microprocessor does, but those are its three basic activities. The following diagram shows an extremely simple microprocessor capable of doing those three things: This is about as simple as a microprocessor gets. This microprocessor has:
• An address bus (that may be 8, 16 or 32 bits wide) that sends an address to memory
• A data bus (that may be 8, 16 or 32 bits wide) that can send data to memory or receive data from memory
• An RD (read) and WR (write) line to tell the memory whether it wants to set or get the addressed location
• A clock line that lets a clock pulse sequence the processor
• A reset line that resets the program counter to zero (or whatever) and restarts execution
Let's assume that both the address and data buses are 8 bits wide in this example.
Here are the components of this simple microprocessor:
• Registers A, B and C are simply latches made out of flip-flops.( ดูหมวด " ทริกเกอร์ สลักขอบในแล้วตรรกะงานสำหรับรายละเอียด )
- ที่อยู่สลักเป็นเหมือนรีจิสเตอร์ A , B และ C .
- โปรแกรมเคาน์เตอร์เป็นกลอนที่มีความสามารถพิเศษ เพิ่ม โดยเมื่อสั่งให้ทำเช่นนั้น และยังตั้งศูนย์เมื่อบอก ทำดังนั้น .
- ALU สามารถเป็นง่ายๆเป็น 8-bit Adder ( ดูเพิ่มเติมในส่วนของวิธีตรรกะ worksfor รายละเอียด ) or it might be able to add, subtract, multiply and divide 8-bit values. Let's assume the latter here.
• The test register is a special latch that can hold values from comparisons performed in the ALU. An ALU can normally compare two numbers and determine if they are equal, if one is greater than the other, etc.แบบลงทะเบียนก็ยังปกติถือบิตทดจากขั้นตอนสุดท้ายของงูพิษ มันเก็บค่าเหล่านี้ flops พลิก แล้วสอนถอดรหัสสามารถใช้ค่าในการตัดสินใจ
- มี 6 กล่องเครื่องหมาย " 3-state " ในแผนภาพ เหล่านี้เป็นสามรัฐบัฟเฟอร์ เป็นรัฐไตรบัฟเฟอร์สามารถผ่าน 1 a 0 or it can essentially disconnect its output (imagine a switch that totally disconnects the output line from the wire that the output is heading toward). A tri-state buffer allows multiple outputs to connect to a wire, but only one of them to actually drive a 1 or a 0 onto the line.
- การลงทะเบียนและถอดรหัสการรับผิดชอบในการควบคุมทั้งหมดของส่วนประกอบอื่น ๆ .
ถึงแม้ว่าพวกเขาจะไม่แสดงในแผนภาพนี้ จะมีสายควบคุมจากการถอดรหัสที่ :
- บอกทะเบียนติดค่าปัจจุบันข้อมูลรถบัส
- บอก B ลงทะเบียนติดค่า ปัจจุบันข้อมูลรถบัส
• Tell the C register to latch the value currently output by the ALU
• Tell the program counter register to latch the value currently on the data bus
• Tell the address register to latch the value currently on the data bus
• Tell the instruction register to latch the value currently on the data bus
• Tell the program counter to increment
• Tell the program counter to reset to zero
- เปิดใช้งานใด ๆของหกรัฐไตรบัฟเฟอร์ ( หกสายแยก )
- บอก ALU สิ่งที่ปฏิบัติการแสดง
- บอกทดสอบลงทะเบียนสลักของ ALU ทดสอบบิต
-
- เปิดใช้งานเปิดใช้งานถนนสายสาย
WR เข้ามาสอนถอดรหัสเป็นบิตจากการทดสอบลงทะเบียนและนาฬิกา บรรทัดเช่นเดียวกับบิตจากการลงทะเบียน
การแปล กรุณารอสักครู่..
