Main Page | Modules | Class Hierarchy | Class List | File List | Class Members | File Members | Related Pages | Examples

ac_decoder.c File Reference

Creates the decoder for the target ISA. More...

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "ac_decoder.h"

Include dependency graph for ac_decoder.c:

Include dependency graph

Go to the source code of this file.

Defines

#define BUFFER(index)   ((index<*quant) ? (buffer[index]) : (*quant=ExpandInstrBuffer(index),buffer[index]))

Functions

int ExpandInstrBuffer (int index)
 External function that updates the instruction buffer pointer, the quantity and the relative index.

unsigned long long GetBits (unsigned char *buffer, int *quant, int last, int quantity, int sign)
char * NewString (const char *s)
void ShowDecField (ac_dec_field *f)
void ShowDecFormat (ac_dec_format *f)
void ShowDecodeList (ac_dec_list *l)
void ShowDecInstr (ac_dec_instr *i)
void ShowDecoder (ac_decoder *d, unsigned level)
void MemoryError (char *fileName, long lineNumber, char *functionName)
void ShowError (char *msg)
int CompareFields (const void *p1, const void *p2)
 Compare two fields. Used in qsort and bsearch.

int CheckFields (const ac_dec_field *f1, const ac_dec_field *f2)
void FreeDecField (ac_dec_field *f)
ac_dec_fieldFindDecField (ac_dec_field *fields, char *name)
ac_dec_fieldPutIDs (ac_dec_format *formats, unsigned nFields)
ac_decoderAddToDecoder (ac_decoder *decoder, ac_dec_instr *instruction, ac_dec_field *fields)
ac_decoder_full * CreateDecoder (ac_dec_format *formats, ac_dec_instr *instructions)
ac_dec_instrFindInstruction (ac_decoder_full *decoder, unsigned char *buffer, int quant)
ac_dec_formatFindFormat (ac_dec_format *formats, char *name)
ac_dec_instrGetInstrByID (ac_dec_instr *instr, int id)
unsigned * DecodeAsInstruction (ac_decoder_full *decoder, ac_dec_instr *instruction, unsigned char *buffer, int quant)
unsigned * Decode (ac_decoder_full *decoder, unsigned char *buffer, int quant)


Detailed Description

Creates the decoder for the target ISA.

This file contains the functions needed to create the decoder for the target ISA described in the ArchC file.

Definition in file ac_decoder.c.


Function Documentation

unsigned* DecodeAsInstruction ac_decoder_full *  decoder,
ac_dec_instr instruction,
unsigned char *  buffer,
int  quant
 

Allocate only the first time

Looking for the instruction format structure.

Get Format's field list

Definition at line 505 of file ac_decoder.c.

References ac_dec_field, ac_dec_format, ac_dec_instr, decoder, _ac_dec_instr::format, and GetBits().

Here is the call graph for this function:

int ExpandInstrBuffer int  index  ) 
 

External function that updates the instruction buffer pointer, the quantity and the relative index.

Function for decoder that updates the instruction buffer pointer, the bytes quantity available and the old relative index.

Definition at line 84 of file archc.cpp.

References AC_ERROR.

unsigned long long GetBits unsigned char *  buffer,
int *  quant,
int  last,
int  quantity,
int  sign
 

Read the buffer using this macro

Definition at line 45 of file ac_decoder.c.

Referenced by DecodeAsInstruction().

char* NewString const char *  s  ) 
 

This function copies a string into a new allocated memory region

Parameters:
s The string to be copied
Returns:
A new copy of the string into a new allocated memory region

Definition at line 106 of file ac_decoder.c.


Generated on Thu Jun 24 08:30:06 2004 for ArchC by doxygen 1.3.4