Assembly language processor with sample assembly language codes.

Cerrado Publicado Dec 4, 2004 Pagado a la entrega
Cerrado Pagado a la entrega

In this project component, each group of students will design and implement an Assembler software model capable of accepting input in the form of a text file - the development language must be ANSI C (not Java or C++). This text file will contain an assembly language program that conforms to the syntax and grammar of the assembly language introduced below. The output from the Assembler will consist of two items, one is a report of the assembly language translation to machine code (either as a text file or a screen output) and the other is a binary file containing the translation (so-called object file). An Assembly language may be designed for each specific machine architecture. It is the machine architecture, its instruction set and its instruction architecture (or format) that defines the end result of the assembly to machine language translation. In this respect, all students should be mindful of the fact that the ultimate goal of producing a machine language program is to have the machine execute that program, based on the underlying architecture as discussed in the lectures

## Deliverables

Project Objectives: Your project MUST satisfy the following specific goals as a minimum requirement: Support the directives: END, DEC, HEX. A directive is a special kind of pseudo-instruction (ie. not a real instruction at execution time) that directs the Assembler program to perform certain specific actions. The END directive signifies the end of the source code listing and is a signal that the Assembler can either begin its second pass through the code or finish the translation process. DEC signifies that its operands are signed decimal values that must be converted to signed binary (ie. 2's complement) values, while HEX signifies that its operand is a hexadecimal value. Support symbolic address reference labels. These must start with alphabetic character, be of length 1-3 alphanumeric characters and terminate using a comma (',') . Support operation mnemonic syntax with hexadecimal object codes defined through the translation. Support assembly instruction grammar, with or without symbolic address reference labels: LBL, OPMNEMONIC | OPERAND | I LBL OPMNEMONIC | OPERAND | I where the I operand signifies that the highest order bit in the instruction bit string is set to 1, indicating indirect addressing mode is being used during execution. Full support for all instructions listed below. Instruction Mnemonic OpCode (hex) Instruction Meaning AND 0/8 AND the memory operand value with the AC ADD 1/9 Add the memory operand value to the AC SUB 2/A Subtract the memory operand value from the AC LDA 3/B Load the memory operand value into the AC STA 4/C Store the AC into memory at the operand address BUN 5/D Branch unconditionally to the operand address by placing that address into the PC ISZ 6/E Load the value from the operand address into the AC, then increment AC and test: if AC is not zero then go to the next instruction - otherwise, if zero, update the PC so that the next instruction to be executed is the one following the next instruction in sequence CLA 7800 Clear the AC CMA 7200 Complement the AC INC 7020 Increment the AC SPA 7010 Skip the next instruction if the AC contains a positive value (>0) SZA 7004 Skip the next instruction if the AC contains a zero value HLT 7001 Halt the computer There are two types of instructions in the table above. The first seven (AND to ISZ) are called memory reference instructions because they each reference an operand which is in RAM. The next six (CLA to HLT) are called register reference instructions because they do not reference RAM, rather only the AC register (or the Clock for HLT), although several instructions from both groups may modify the PC register as well. For the memory reference instructions two different OpCodes are provided, separated by a slash (/). The first value indicates that direct addressing mode is used, where the value is fetched from (or stored to in the case of STA) RAM and used directly by the instruction logic. The second value indicates that indirect addressing mode is used, where the value that is fetched from RAM is used as an address (note that not all the bits fetched will be used, only the low order bits that make up an address) and then a second RAM fetch (or store) is performed using that address - hence, this is called indirect addressing. Register reference instructions do not have a 4-bit OpCode because they do not need to reference RAM during execution. Thus, all such instructions have the same OpCode, namely 7 (in 4-bit form, 0111). To discriminate between the several such instructions with the same OpCode, the next 12 bits of the address field are used. In principle, therefore, 12 different instructions can be coded for using only 1 of the 12 bits to distinguish between instructions. It is possible to use different bit combinations as well, but it is usually simpler to use a single bit as a control mechanism on the hardware logic. The Assembler must produce a final (printable, i.e. text) listing of the assembly language program and the corresponding allocation addresses and object codes produced. A listing of the Symbol Table(s) used during the assembly process must also be produced. Examples of these reports are given below for the simple model introduced in the lectures. The Assembler must also produce a binary file (ie. a file containing only 0's and 1's as bit strings) that, in principle, could be inputted to a compatible machine architecture model and consequently executed by that machine. -------------------------------------------------------------------------------- Hexadecimal code -------------------------------------------------------------------------------- Statement Location Content Label Program 1 000 3007 LDA SUB 2 001 7200 CMA 3 002 7020 INC 4 003 1006 ADD MIN 5 004 4008 STA DIF 6 005 7001 HLT 7 006 0053 MIN, DEC 83 8 007 FFE9 SUB, DEC -23 9 008 0000 DIF, HEX 0 10 END An example Symbol Table layout for label identification is shown below. Sorting the table on the label permits use of binary search for lengthy programs with many labels. The label declaration point identifies the Location value, in hexadecimal (3 hex digits = 12 bit address) that can be used to resolve a label reference in an instruction. The Statement number is useful for human programmers, while the Content and Reference (list) information is often listed and may be used by programmers. -------------------------------------------------------------------------------- Symbol Table -------------------------------------------------------------------------------- Symbol Location Statement Content Reference DIF 008 9 0000 005 MIN 006 7 0053 004 SUB 007 8 FFE9 001 NOTES: Using the principle of required prior declaration, wherein a symbolic reference (such as an address label or variable name label) can be resolved immediately if it has already been defined, hence a single-pass assembler strategy would be adequate to translate the program into machine code. However, note that in cases where the symbol is not known when first referenced, a second pass is required. As is always the case, additional features and capabilites may be added to the basic requirements list above in order to earn additional marks. In all cases, these added features and capabilites must be fully documented and explained. In order to demonstrate and test your Assembler, you must produce (and submit) at least one example assembly language program in the form of a source code file (that must contain only ASCII characters). General Comments: The strategy for coding the Assembler should be a two-pass approach. On the first pass through the assembly language source file you should concentrate on identifying and defining all the symbols used for referencing purposes through a Symbol Table. On the second pass through the source file you will have all the information you need to perform a complete translation of each assembly language statement; that is, translation of the Operation mnemonic, any symbolic references and the I-bit, if used for indirect memory addressing mode instructions.

## Platform

The programming should be done in C and should run on a unix system

Assembler Ingeniería MySQL PHP Arquitectura de software Verificación de software

Nº del proyecto: #3464789

Sobre el proyecto

2 propuestas Proyecto remoto Activo Dec 5, 2004

2 freelancers están ofertando un promedio de $45 por este trabajo

esixoft

See private message.

$39.95 USD en 3 días
(29 comentarios)
5.0
yevgenyt

See private message.

$51 USD en 3 días
(9 comentarios)
2.6