0% found this document useful (0 votes)
65 views9 pages

Design Specifications of An Assembler - 20241106 - 122535 - 0000

SSAND OS DESIGN SPECIFICATIONS OF AN ASSEMBLER

Uploaded by

Simal Jaan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
65 views9 pages

Design Specifications of An Assembler - 20241106 - 122535 - 0000

SSAND OS DESIGN SPECIFICATIONS OF AN ASSEMBLER

Uploaded by

Simal Jaan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

DESIGN

SPECIFICATIONS OF
AN ASSEMBLER
BY BHAVANA UNNIKRISHNAN

1
A four step approach is used to develop a design specification for an assembler
1.Identify the information necessary to perform a task
2.Design a suitable data Structure to record the information
3.Determine the processing necessary to obtain and maintain information.
4. Identify the processing necessary to perform a task

2
1.Identify the information necessary to perform a task
The fundamental information requirements arise in the synthesis phase of an
assembler. Hence it is best to begin by considering the information requirements of
synthesis tasks
The information is collected during analysis or derived during synthesis phase
For example considered the following statement

MOVER BREG ONE

The following information is required to synthesize the machine instruction


corresponding to this statement
(i) Address of the memory word with which name ONE is associated.
(ii) Machine operation code corresponding to the mnemonic MOVER

3
2.Design a suitable Data Structure to record the information
(i)SYMTAB: symbol table
(ii)OPTAB: operation code table
(iii)LOCCTR: location counter
(i)SYMTAB
•Fields: symbol name, address
•It is a dynamic table built by analysis phase
•To indicate error conditions
•Insert,delete and search allowed
•Usually use a Hash table
(ii)OPTAB
•Fields : Mnemonic, opcode, length
•It is a static table
•Array or Hash table
•Usually use a Hash table
(iii)LOCCTR
•Initialise to be the beginning address specified in the "START" statement
•LOCCTR=LOCCTR+(instruction length) The current value of LOCCTR gives the address to 4
the label or symbol encountered
5
3.Determine the processing necessary to obtain and maintain the information

For building symbol table during analysis phase, it is necessary to determine the
address with which the symbol names used in a program is associated. It is possible
to determine some addresses directly e.g. the address of the first instruction in the
program, however others must be inferred. To determine the address of an instruction,
it is required to fix the addresses of all instructions preceding it. This function is called
memory allocation

To implement memory allocation, the data structure location counter(LC) is used. The
location counter is always made to contain the address of the next memory word in
the target program. It is initialised to the constant specified in the START statement.
Whenever the analysis phase sees a label in an assembly statement, it enters the label
and contents of LC in a new entry of the symbol table. It then find the number of
memory words required by the Assembly statement and updates the LC contents. The
information about the length of different instructions is included in the opcode. The
processing involved in a maintaining the location counter is referred as LC processing 6
4.Determine the processing necessary to perform the task

The tasks performed by the analysis and synthesis phases are as follows:

Analysis Phase
•Isolate the label,mnemonic opcode and operand fields of a statement.
•If a label is present enter the pair(<symbol >,<LC contents>) in a new entry of
symbol table
•Check validity of the mnemonic opcode through a look-up in the Opcode table
•Perform LC processing i.e. update the value contained in LC by considering the
opcode and operands of the statements.

Synthesis Phase
•Obtain the machine opcode corresponding to the mnemonic from the opcode
table.
•Obtain address of a memory operand from the symbol table
•Synthesize a machine instruction or the machine form of a constant as the case 7

maybe
Assembler design options
1. One-pass assemblers
2. Two-pass assembles

8
THANK
YOU
9

You might also like