TAILIEUCHUNG - Lecture Introduction to computing systems (2/e): Chapter 10 - Yale N. Patt, Sanjay J. Patel

Chapter 10 - And, stack. In this chapter, the following content will be discussed: The stack: its basic structure, interrupt-driven I/O, arithmetic using a stack, data type conversion, our final example: the calculator. | Chapter 10 And, Finally. A Final Collection of ISA-related Topics Stacks Important low-level data structure ASCII-Decimal Conversion Converting between human-friendly and computer-friendly representations Interrupt-Driven I/O Efficient, device-controlled interactions 10- Stacks A LIFO (last-in first-out) storage structure. The first thing you put in is the last thing you take out. The last thing you put in is the first thing you take out. This means of access is what defines a stack, not the specific implementation. Two main operations: PUSH: add an item to the stack POP: remove an item from the stack 10- A Physical Stack Coin rest in the arm of an automobile First quarter out is the last quarter in. 1995 1996 1998 1982 1995 1998 1982 1995 Initial State After One Push After Three More Pushes After One Pop 10- A Hardware Implementation Data items move between registers / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / Yes Empty: TOP #18 / / / / / / / / / / / / / / / / / / / / / / / / No Empty: TOP #12 #5 #31 #18 / / / / / / No Empty: TOP #31 #18 / / / / / / / / / / / / / / / / / / No Empty: TOP Initial State After One Push After Three More Pushes After Two Pops 10- A Software Implementation Data items don't move in memory, just our idea about there the TOP of the stack is. / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / TOP #18 / / / / / / / / / / / / / / / / / / / / / / / / TOP #18 #31 #5 #12 / / / / / / TOP #18 #31 #5 #12 / / / / / / TOP Initial State After One Push After Three More Pushes After Two Pops x3FFF x4000 x4003 x4001 R6 R6 R6 R6 By convention, R6 holds the Top of Stack (TOS) pointer. 10- Basic Push and Pop Code Push ADD R6, R6, #1 ; increment stack ptr STR R0, R6, #0 ; store data (R0) Pop LDR R0, R6, #0 ; load data from TOS ADD R6, R6, #-1 ; decrement stack ptr 10- Pop with Underflow Detection If we try to pop too many items off the stack, an underflow condition occurs. Check for underflow by checking

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.