8768

Last Updated on 03/19/2023 by Sophia

In this assignment you will be implementing and performing operations on a virtual stack. You will need to emulate this virtual stack to store and reference variables and stack frame contexts before reading a set of pseudo assembly instructions that dictate the operations that should be performed on the stack. Your program will take a single command line argument being the name of the file containing your pseudo-assembly code. Before attempting this assignment it would be a good idea to familiarise yourself with the stack, registers, stack frames, stack pointers, and program counters. Over the course of this assignment you will need to track your own stack frames, manage operatons, dynamic memory and file handling. Command Format You will be provided with a series of commands as operations taking the form: ([Address][Address_type])[Address][Address_type][Operation Code] A series of operations form a function and will have some associated unique 4 bit label. The second address and address type field is optional and will not be required for unary operations. The address type specifies whether it is a stack address, a value, a register address or a pointer to another stack address. Stack addresses are 7 bits long, register addresses are 3 bits long and values are 8 bits long and pointer addresses are also 7 bits long. The address type itself is two bits long and specifies the type of the preceding address. 00 – value: 1 byte long. The value in the preceding 8 bits should be interpreted as a single byte value. 01 – register address: 3 bits long. This address refers to one of the eight fixed registers 10 – stack address: 7 bits long. This refers to an address on the stack containing a single byte. 11 – pointer valued: 7 bits long. This refers to an address on the stack containing a single byte that itself refers to another address on the stack. This is useful for accessing the stack pointer. The registers cannot be accessed using this pointer. Document Preview:

COMP2017/COMP9017 Assignment1Due: April 19th, 10pm AEST (Week 6 Thursday)This assignment is worth 4% of your ?nal assessmentTaskDescriptionIn this assignment you will be implementing and performing operations on a virtual stack. You willneed to emulate this virtual stack to store and reference variables and stack frame contexts beforereading a set of pseudo assembly instructions that dictate the operations that should be performedon the stack. Your program will take a single command line argument being the name of the ?lecontaining your pseudo-assembly code. Before attempting this assignment it would be a good ideato familiarise yourself with the stack, registers, stack frames, stack pointers, and program counters.Over the course of this assignment you will need to track your own stack frames, manage operatons,dynamic memory and ?le handling.CommandFormatYou will be provided with a series of commands as operations taking the form:([Address][Address_type])[Address][Address_type][Operation Code]A series of operations form a function and will have some associated unique 4 bit label.The second address and address type ?eld is optional and will not be required for unary operations.The address type speci?es whether it is a stack address, a value, a register address or a pointer toanother stack address. Stack addresses are 7 bits long, register addresses are 3 bits long and valuesare 8 bits long and pointer addresses are also 7 bits long.The address type itself is two bits long and speci?es the type of the preceding address.00 – value: 1 byte long. The value in the preceding 8 bits should be interpreted as a single bytevalue.01 – register address: 3 bits long. This address refers to one of the eight ?xed registers10 – stack address: 7 bits long. This refers to an address on the stack containing a single byte.11 – pointer valued: 7 bits long. This refers to an address on the stack containing a single byte thatitself refers to another address on…

Attachments:

1-virtual-sta….pdf