OpenASIP
2.0
|
#include <DataSection.hh>
Public Member Functions | |
virtual | ~DataSection () |
virtual SectionType | type () const |
virtual Byte | byte (const Chunk *chunk) const |
virtual Byte | byte (Word offset) const |
virtual void | addByte (Byte aByte) |
virtual MinimumAddressableUnit | MAU (Word index) const |
virtual void | addMAU (MinimumAddressableUnit aMAU) |
virtual void | writeValue (Word index, Word numOfMAUs, unsigned long value) |
virtual void | writeValue (Word index, Word numOfMAUs, signed long value) |
virtual Word | length () const |
virtual void | setDataLength (Word length) |
virtual bool | isDataSection () const override |
Public Member Functions inherited from TPEF::UDataSection | |
virtual | ~UDataSection () |
Public Member Functions inherited from TPEF::RawSection | |
virtual bool | isChunkable () const |
virtual Chunk * | chunk (SectionOffset offset) const |
virtual void | assureInSection (SectionOffset offset) const |
virtual | ~RawSection () |
bool | empty () const |
virtual void | setLengthInMAUs (Word length) |
virtual Word | lengthInMAUs () const |
virtual Word | bytesToMAUs (Word byteCount) const |
virtual Word | MAUsToBytes (Word mauCount) const |
virtual Word | chunkToMAUIndex (const Chunk *chunk) const |
Word | referredChunkCount () const |
Chunk * | referredChunk (Word index) const |
bool | belongsToSection (const Chunk *chunk) const |
Public Member Functions inherited from TPEF::Section | |
virtual | ~Section () |
bool | isProgramSection () const |
bool | isAuxSection () const |
virtual void | addElement (SectionElement *element) |
virtual void | setElement (Word index, SectionElement *element) |
SectionElement * | element (Word index) const |
Word | elementCount () const |
void | setFlagNoBits () |
void | unsetFlagNoBits () |
bool | noBits () const |
bool | vLen () const |
Byte | flags () const |
void | setFlags (Byte flagByte) |
void | setStartingAddress (AddressImage address) |
AddressImage | startingAddress () const |
void | setLink (const ReferenceManager::SafePointer *aLink) |
void | setLink (Section *aLink) |
Section * | link () const |
void | setASpace (const ReferenceManager::SafePointer *addrSpace) |
void | setASpace (ASpaceElement *addrSpace) |
ASpaceElement * | aSpace () const |
void | setName (const ReferenceManager::SafePointer *sectionName) |
void | setName (Chunk *sectionName) |
Chunk * | name () const |
virtual bool | isCodeSection () const |
Public Member Functions inherited from TPEF::SafePointable | |
virtual | ~SafePointable () |
Protected Member Functions | |
DataSection (bool init) | |
virtual Section * | clone () const |
virtual void | setByte (Word offset, Byte aByte) |
Protected Member Functions inherited from TPEF::UDataSection | |
UDataSection (bool init) | |
Protected Member Functions inherited from TPEF::RawSection | |
RawSection () | |
Protected Member Functions inherited from TPEF::Section | |
Section () | |
void | setFlagVLen () |
void | unsetFlagVLen () |
Protected Member Functions inherited from TPEF::SafePointable | |
SafePointable () | |
Private Attributes | |
std::vector< Byte > | data_ |
Contains the data of data section. More... | |
Static Private Attributes | |
static DataSection | proto_ |
Prototype instance of section. More... | |
Additional Inherited Members | |
Public Types inherited from TPEF::Section | |
enum | SectionType { ST_NULL = 0x00, ST_STRTAB = 0x01, ST_SYMTAB = 0x02, ST_DEBUG = 0x03, ST_RELOC = 0x04, ST_LINENO = 0x05, ST_NOTE = 0x06, ST_ADDRSP = 0x07, ST_MR = 0x0A, ST_CODE = 0x81, ST_DATA = 0x82, ST_UDATA = 0x83, ST_LEDATA = 0x84, ST_DUMMY = 0xff } |
enum | SectionFlag { SF_VLEN = 0x40, SF_NOBITS = 0x80 } |
Static Public Member Functions inherited from TPEF::Section | |
static Section * | createSection (SectionType type) |
static bool | isProgramSection (SectionType type) |
Static Protected Member Functions inherited from TPEF::Section | |
static void | registerSection (const Section *section) |
Data section for initialized data.
Derives from uninitialized data section so, this is extension of UDataSection.
Definition at line 52 of file DataSection.hh.
|
virtual |
|
protected |
Constructor.
init | true if registeration is wanted |
Definition at line 51 of file DataSection.cc.
References TPEF::Section::registerSection(), TPEF::Section::unsetFlagNoBits(), and TPEF::Section::unsetFlagVLen().
Referenced by clone().
|
virtual |
Adds byte of data into section.
Method copies data that is given in parameter.
aByte | Byte that will be copied into the section. |
Definition at line 200 of file DataSection.cc.
References data_.
Referenced by addMAU(), TTAProgram::ProgramWriter::createBinary(), TPEF::TPEFDataSectionReader::readData(), TPEF::TPEFStringSectionReader::readData(), TPEF::AOutStringSectionReader::readData(), TPEF::AOutDataSectionReader::readData(), setDataLength(), TPEF::StringSection::string2Chunk(), and MachineResourceManager::stringToChunk().
|
virtual |
Adds MAU to the end of section.
aMAU | MAU that will be copied into the section. |
OutOfRange | If the given value could not fit to the bit count defined by the address space's MAU width (when interpreted as unsigned or signed integer). |
Definition at line 150 of file DataSection.cc.
References __func__, addByte(), TPEF::Section::aSpace(), BYTE_BITWIDTH, TPEF::ASpaceElement::MAU(), MathTools::requiredBits(), and MathTools::requiredBitsSigned().
Referenced by TTAProgram::ProgramWriter::createDataSections().
Returns byte from chunk's offset.
chunk | Chunk containing offset of data. |
Reimplemented from TPEF::UDataSection.
Definition at line 114 of file DataSection.cc.
References TPEF::RawSection::chunk(), data_, and TPEF::Chunk::offset().
Referenced by TPEF::TPEFStringSectionWriter::actualWriteData(), TPEF::TPEFDataSectionWriter::actualWriteData(), TPEF::TPEFStringSectionReader::readData(), TPEF::AOutStringSectionReader::readData(), TPEFDumper::section(), and ProgramImageGenerator::writeDataSection().
|
virtual |
Returns byte from byte offset.
offset | Offset of data. |
Definition at line 188 of file DataSection.cc.
References data_.
|
protectedvirtual |
Creates an instance of DataSection.
Reimplemented from TPEF::UDataSection.
Reimplemented in TPEF::LEDataSection, and TPEF::StringSection.
Definition at line 103 of file DataSection.cc.
References DataSection().
|
inlineoverridevirtual |
|
virtual |
Returns the size of the data section in bytes.
Reimplemented from TPEF::RawSection.
Definition at line 210 of file DataSection.cc.
References data_.
Referenced by TPEF::TPEFStringSectionWriter::actualWriteData(), TPEF::TPEFDataSectionWriter::actualWriteData(), TPEF::StringSection::chunk2String(), TTAProgram::ProgramWriter::createDataSections(), TPEF::AOutRelocationSectionReader::finalize(), TPEF::AOutStringSectionReader::readData(), TPEF::AOutReader::readData(), TPEFDumper::section(), setDataLength(), TPEF::StringSection::string2Chunk(), and ProgramImageGenerator::writeDataSection().
|
virtual |
Returns one MAU from section by gived MAU index.
index | Index of MAU to return. |
Definition at line 125 of file DataSection.cc.
References BYTE_BITWIDTH, and TPEF::RawSection::MAUsToBytes().
Referenced by TTAProgram::TPEFProgramFactory::createDataMemories(), TPEF::TPEFRelocSectionReader::finalize(), and TPEFDumper::section().
|
protectedvirtual |
Sets value of one byte of data section.
NOTE: Byte here is tpef file byte. (8bits).
offset | Offset where to write the byte. |
aByte | Value to write. |
Definition at line 86 of file DataSection.cc.
References abortWithError, data_, and Conversion::toString().
Referenced by TPEF::LEDataSection::writeValue(), and writeValue().
|
virtual |
Tries to set data length.
Can be used only for making section bigger. Asserts if method is tried to use for making section smaller.
Initializes data with zeros.
length | Length to which section is expanded. |
Reimplemented from TPEF::RawSection.
Definition at line 225 of file DataSection.cc.
References addByte(), assert, and length().
|
virtual |
Returns section's type.
Reimplemented from TPEF::UDataSection.
Reimplemented in TPEF::LEDataSection, and TPEF::StringSection.
Definition at line 73 of file DataSection.cc.
References TPEF::Section::ST_DATA.
|
virtual |
Writes signed value to data section.
For example, when we call writeValue(0, 4, -3) and MAU is 2bit start of data section will be 11 11 11 01.
MAUs are stored in data section like this: 00000011 000000011 00000011 00000001 (one MAU per byte)
If we call writeValue(0, 4, -3) and MAU is 10bit start of data section will be 1111111111 1111111111 1111111111 1111111101.
However the MAUs are stored in data section like this:
00000011 11111111|00000011 11111111|00000011 11111111|00000011 11111101| MAU1 | MAU2 | MAU3 | MAU4 |
index | MAU offset to section where to we write value. |
numOfMAUs | Number of MAUs that we use for storing value. |
value | Value to write. |
Reimplemented in TPEF::LEDataSection.
Definition at line 305 of file DataSection.cc.
References TPEF::Section::aSpace(), BYTE_BITWIDTH, TPEF::ASpaceElement::MAU(), TPEF::RawSection::MAUsToBytes(), and setByte().
|
virtual |
Writes unsigned value to data section.
Value is aligned to field as normal big endian value least significant bit is stored to last bit of last MAU.
If we call writeValue(0, 4, 3) and MAU is 2bit start of data section will be 00 00 00 11.
However the MAUs are stored in data section like this: 00000000|000000000|00000000|00000011 (one MAU per byte) MAU1 | MAU2 | MAU3 | MAU4
index | MAU offset to section where to we write value. |
numOfMAUs | Number of MAUs that we use for storing value. |
value | Value to write. |
Reimplemented in TPEF::LEDataSection.
Definition at line 250 of file DataSection.cc.
References TPEF::Section::aSpace(), BYTE_BITWIDTH, TPEF::ASpaceElement::MAU(), TPEF::RawSection::MAUsToBytes(), and setByte().
Referenced by TPEF::AOutRelocationSectionReader::finalize(), and DataSectionCreator::writeDataLineToTPEF().
|
private |
|
staticprivate |
Prototype instance of section.
Definition at line 80 of file DataSection.hh.