Replace TRUE/FALSE with boolean values true/false

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
(cherry picked from commit ffcbae7cc6)
r14.1.x
Michele Calgaro 1 year ago
parent ee224f9d08
commit 191287fc26
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -85,7 +85,7 @@ bool CAssembler::buildSymbolTable()
{
list<CSourceLine*>::iterator it ;
unsigned int address = 0 ;
bool ret = TRUE ;
bool ret = true ;
for ( it = m_source.begin() ; it != m_source.end() ; it++ ) {
string name = toUpper( (*it)->getColumn( 0 ) ) ; // case insensitive
@ -93,17 +93,17 @@ bool CAssembler::buildSymbolTable()
if ( name == "NAMEREG" ) {
if ( !(*it)->isColumn( 3 ) ) {
error( (*it)->m_lineNr, "'NAMEREG registername, newname' expected" ) ;
ret = FALSE ;
ret = false ;
}
if ( (*it)->isColumn( 4 ) ) {
error( (*it)->m_lineNr, "Rubbish found at end of line" ) ;
ret = FALSE ;
ret = false ;
}
if ( (*it)->getColumn( 2 ) != "," ) {
error( (*it)->m_lineNr, "Comma expected" ) ;
ret = FALSE ;
ret = false ;
}
@ -116,18 +116,18 @@ bool CAssembler::buildSymbolTable()
} else if ( name == "CONSTANT" ) {
if ( !(*it)->isColumn( 3 ) ) {
error( (*it)->m_lineNr, "'CONSTANT name, valued' expected" ) ;
ret = FALSE ;
ret = false ;
}
if ( (*it)->isColumn( 4 ) ) {
error( (*it)->m_lineNr, "Rubbish found at end of line" ) ;
ret = FALSE ;
ret = false ;
}
if ( (*it)->getColumn( 2 ) != "," ) {
error( (*it)->m_lineNr, "Comma expected" ) ;
ret = FALSE ;
ret = false ;
}
CConstant *nr = new CConstant ;
@ -138,17 +138,17 @@ bool CAssembler::buildSymbolTable()
} else if ( name == "ADDRESS" ) {
if ( !(*it)->isColumn( 1 ) ) {
error( (*it)->m_lineNr, "Value expected" ) ;
ret = FALSE ;
ret = false ;
}
if ( (*it)->isColumn( 4 ) ) {
error( (*it)->m_lineNr, "Rubbish found at end of line" ) ;
ret = FALSE ;
ret = false ;
}
if ( sscanf( (*it)->getColumn( 1 ).c_str(), "%X", &address ) != 1 ) {
error( (*it)->m_lineNr, "Invalid address" ) ;
ret = FALSE ;
ret = false ;
}
(*it)->m_type = CSourceLine::stAddress ;
(*it)->m_address = address ;
@ -167,14 +167,14 @@ bool CAssembler::buildSymbolTable()
if ( (*it)->isColumn( 2 ) ) {
if ( getInstruction( (*it)->getColumn( 2 ) ) < 0 ) {
error( (*it)->m_lineNr, "Instruction expected" ) ;
ret = FALSE ;
ret = false ;
} else {
address = address + 1 ;
}
}
} else {
error( (*it)->m_lineNr, "Label or Instruction expected" ) ;
ret = FALSE ;
ret = false ;
}
} else {
(*it)->m_address = address ;
@ -255,7 +255,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
case DISABLE:
if ( toUpper( s1 ) != "INTERRUPT" ) {
error( line, "'INTERRUPT' expected" ) ;
return FALSE ;
return false ;
}
if ( instr == ENABLE )
code = instrENABLE_INTERRUPT ;
@ -281,44 +281,44 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
case CALL:
case JUMP:
case RETURN:
b = TRUE ;
b = true ;
maxColumn= 2 ;
if ( toUpper( s1 ) == "C" ) {
switch( instr ) {
case CALL : code = instrCALLC ; break ;
case JUMP : code = instrJUMPC ; break ;
case RETURN : code = instrRETURNC ; break ;
default: error( line, "'CALL', 'JUMP' or 'RETURN' expected" ) ; return FALSE ;
default: error( line, "'CALL', 'JUMP' or 'RETURN' expected" ) ; return false ;
}
} else if ( toUpper( s1 ) == "NC" ) {
switch( instr ) {
case CALL : code = instrCALLNC ; break ;
case JUMP : code = instrJUMPNC ; break ;
case RETURN : code = instrRETURNNC ; break ;
default: error( line, "'CALL', 'JUMP' or 'RETURN' expected" ) ; return FALSE ;
default: error( line, "'CALL', 'JUMP' or 'RETURN' expected" ) ; return false ;
}
} else if ( toUpper( s1 ) == "NZ" ) {
switch( instr ) {
case CALL : code = instrCALLNZ ; break ;
case JUMP : code = instrJUMPNZ ; break ;
case RETURN : code = instrRETURNNZ ; break ;
default: error( line, "'CALL', 'JUMP' or 'RETURN' expected" ) ; return FALSE ;
default: error( line, "'CALL', 'JUMP' or 'RETURN' expected" ) ; return false ;
}
} else if ( toUpper( s1 ) == "Z" ) {
switch( instr ) {
case CALL : code = instrCALLZ ; break ;
case JUMP : code = instrJUMPZ ; break ;
case RETURN : code = instrRETURNZ ; break ;
default: error( line, "'CALL', 'JUMP' or 'RETURN' expected" ) ; return FALSE ;
default: error( line, "'CALL', 'JUMP' or 'RETURN' expected" ) ; return false ;
}
} else {
switch( instr ) {
case CALL : code = instrCALL ; break ;
case JUMP : code = instrJUMP ; break ;
case RETURN : code = instrRETURN ; break ;
default: error( line, "'CALL', 'JUMP' or 'RETURN' expected" ) ; return FALSE ;
default: error( line, "'CALL', 'JUMP' or 'RETURN' expected" ) ; return false ;
}
b = FALSE ;
b = false ;
maxColumn = 1 ;
}
@ -327,7 +327,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
if ( b ) {
if ( s2 != "," ) {
error( line, "Comma expected" ) ;
return FALSE ;
return false ;
}
s = s3 ;
} else
@ -340,7 +340,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
if ( sscanf( s.c_str(), "%d", &labelVal ) != 1 ) {
error( line, "Invalid label" ) ;
return FALSE ;
return false ;
}
code |= labelVal ;
@ -352,7 +352,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
int reg = getRegister( translateRegister( s1 ) ) ;
if ( reg < 0 ) {
error( line, "Registername expected" ) ;
return FALSE ;
return false ;
}
code = instrROTATE | (reg<<8) ;
@ -373,7 +373,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
default:
if ( s2 != "," ) {
error( line, "Comma expected" ) ;
return FALSE ;
return false ;
}
switch( instr ) {
@ -385,13 +385,13 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
if ( sourceLine.getColumn( offset + 3 ) == "(" ) {
if ( !sourceLine.isColumn( offset + 5 ) || sourceLine.getColumn( offset + 5 ) != ")" ) {
error( line, "')' expected" ) ;
return FALSE ;
return false ;
}
int reg2 = getRegister( translateRegister( sourceLine.getColumn( offset + 4 ) ) ) ;
if ( reg2 < 0 ) {
error( line, "Register expected" ) ;
return FALSE ;
return false ;
}
code = (reg << 8) | (reg2 << 4) ;
switch( instr ) {
@ -399,7 +399,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
case OUTPUT: code |= instrOUTPUT_SX_SY ; break ;
case INPUT : code |= instrINPUT_SX_SY ; break ;
case FETCH : code |= instrFETCH_SX_SY ; break ;
default: error( line, "'STORE', 'OUTPUT', 'INPUT' or 'FETCH' expected" ) ; return FALSE ;
default: error( line, "'STORE', 'OUTPUT', 'INPUT' or 'FETCH' expected" ) ; return false ;
}
maxColumn = 6 ;
} else {
@ -408,7 +408,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
if ( sscanf( translateConstant( s3 ).c_str(), "%X", &value ) != 1 ) {
sprintf( err_desc, "Value or (regname) expected, but \"%s\" found.", s3.c_str() ) ;
error( line, err_desc ) ;
return FALSE ;
return false ;
}
code = (reg << 8) | value ;
@ -417,7 +417,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
case OUTPUT: code |= instrOUTPUT_SX_PP ; break ;
case INPUT : code |= instrINPUT_SX_PP ; break ;
case FETCH : code |= instrFETCH_SX_SS ; break ;
default: error( line, "'STORE', 'OUTPUT', 'INPUT' or 'FETCH' expected" ) ; return FALSE ;
default: error( line, "'STORE', 'OUTPUT', 'INPUT' or 'FETCH' expected" ) ; return false ;
}
maxColumn = 4 ;
}
@ -432,7 +432,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
if ( sscanf( translateConstant( s3 ).c_str(), "%X", &value ) != 1 ) {
sprintf( err_desc, "Value expected, but \"%s\" found.", s3.c_str() ) ;
error( line, err_desc ) ;
return FALSE ;
return false ;
}
code = (reg << 8) | value ;
switch( instr ) {
@ -446,7 +446,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
case SUBCY : code |= instrSUBCY_SX_KK ; break ;
case TEST : code |= instrTEST_SX_KK ; break ;
case XOR : code |= instrXOR_SX_KK ; break ;
default : error( line, "Unknown instruction" ) ; return FALSE ;
default : error( line, "Unknown instruction" ) ; return false ;
}
} else {
code = ( reg << 8 ) | ( reg2 << 4 ) ;
@ -461,7 +461,7 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
case SUBCY : code |= instrSUBCY_SX_SY ; break ;
case TEST : code |= instrTEST_SX_SY ; break ;
case XOR : code |= instrXOR_SX_SY ; break ;
default : error( line, "Unknown instruction" ) ; return FALSE ;
default : error( line, "Unknown instruction" ) ; return false ;
}
}
}
@ -472,13 +472,13 @@ bool CAssembler::addInstruction( instrNumber instr, CSourceLine sourceLine, int
if ( sourceLine.isColumn( maxColumn + offset ) ) {
sprintf( err_desc, "'%s' found at end of instruction", sourceLine.getColumn( maxColumn + offset ).c_str() ) ;
error( line, err_desc ) ;
return FALSE ;
return false ;
}
// Finally
m_code->setInstruction( address, code, line ) ;
return TRUE ;
return true ;
}
@ -531,14 +531,14 @@ bool CAssembler::exportVHDL( string templateFile, string outputDir, string entit
FILE * infile = fopen( templateFile.c_str(), "r" ) ;
if ( infile == NULL ) {
error( NO_LINE_NR, string( "Unable to open VHDL template file '" + templateFile + "'" ).c_str() ) ;
return FALSE ;
return false ;
}
string exportFile = outputDir + "/" + entityName + ".vhd" ;
FILE * outfile = fopen( exportFile.c_str(), "w" ) ;
if ( outfile == NULL ) {
error( NO_LINE_NR , string( "Unable to open VHDL template file '%s'" + exportFile + ".vhd").c_str() ) ;
return FALSE ;
return false ;
}
bool store = false, copy = false;
@ -585,7 +585,7 @@ bool CAssembler::exportVHDL( string templateFile, string outputDir, string entit
fclose( infile ) ;
fclose( outfile ) ;
return TRUE ;
return true ;
}
bool CAssembler::exportHEX( string filename, bool mem )
@ -593,7 +593,7 @@ bool CAssembler::exportHEX( string filename, bool mem )
FILE * file = fopen( filename.c_str(), "w" ) ;
if ( file == NULL ) {
error( NO_LINE_NR , string( "Unable to write to file '" + filename + "'").c_str() ) ;
return FALSE ;
return false ;
}
CInstruction * instr ;
@ -615,7 +615,7 @@ bool CAssembler::exportHEX( string filename, bool mem )
fclose( file ) ;
return TRUE ;
return true ;
}
@ -623,7 +623,7 @@ bool CAssembler::createOpcodes()
{
list<CSourceLine*>::iterator it ;
int columnOffset ;
bool ret = TRUE ;
bool ret = true ;
for ( it = m_source.begin() ; it != m_source.end() ; it++ ) {
if ( (*it)->m_type == CSourceLine::stNamereg ||
@ -643,11 +643,11 @@ bool CAssembler::createOpcodes()
if ( instr < 0 ) {
error( (*it)->m_lineNr, "Unknown instruction" ) ;
ret = FALSE ;
ret = false ;
}
if ( addInstruction( (instrNumber) instr, **it, columnOffset ) == FALSE )
ret = FALSE ;
if ( addInstruction( (instrNumber) instr, **it, columnOffset ) == false )
ret = false ;
}
return ret ;
@ -656,8 +656,8 @@ bool CAssembler::createOpcodes()
bool CAssembler::assemble( )
{
bool r1, r2 ;
if ( loadFile() == FALSE )
return FALSE ;
if ( loadFile() == false )
return false ;
r1 = buildSymbolTable() ; // Even continue if symbol table failed..
r2 = createOpcodes() ; // .. this way we get the most errors/warnings in 1 compile cycle.
@ -727,7 +727,7 @@ bool CAssembler::loadFile()
if ( f == NULL ) {
string str = "Unable to load file '" + m_filename + "'";
error( NO_LINE_NR, str.c_str() ) ; // No linenumber information
return FALSE ;
return false ;
}
char buf[ 256 ] ;
int linenr = 0 ;
@ -749,6 +749,6 @@ bool CAssembler::loadFile()
cout << "File " << m_filename << " succesfully loaded\r\n" ;
return TRUE ;
return true ;
}

@ -298,26 +298,26 @@ bool CCode::setInstruction( uint16_t address, uint32_t code, unsigned int source
CInstruction *instr = Disassemble( code ) ;
if ( instr == NULL ) {
cout << ">>>>Unknown code at address " << address << "<<<<\r\n" ;
return FALSE ;
return false ;
}
if ( address >= MAX_ADDRESS ) {
cout << ">>>>Invalid address" << address << "<<<<\r\n" ;
delete instr ;
return FALSE ;
return false ;
}
if ( CodeMap[ address ] != NULL ) {
cout << ">>>>Code is placed at same address (" << address << ")<<<<\r\n" ;
delete instr ;
return FALSE ;
return false ;
}
instr->setSourceLine( sourceLine ) ;
CodeMap[ address ] = instr ;
return TRUE ;
return true ;
}
CInstruction * CCode::getInstruction( uint16_t address )
@ -404,7 +404,7 @@ unsigned int CPicoBlaze::GetNextSourceLine()
CInstruction *instr = code->getInstruction( pc->Get() ) ;
if ( instr == NULL ) {
cout << ">>>>Error in simulation (No code found at " << pc->Get() << ")<<<<\r\n" ;
return FALSE ;
return false ;
}
return instr->getSourceLine() ;
@ -415,12 +415,12 @@ bool CPicoBlaze::Next()
CInstruction *instr = code->getInstruction( pc->Get() ) ;
if ( instr == NULL ) {
cout << ">>>>Error in simulation (No code found at " << pc->Get() << ")<<<<\r\n" ;
return FALSE ;
return false ;
}
instr->Execute() ;
return TRUE ;
return true ;
}
void CPicoBlaze::addPort( CIOPort * ioport )

@ -150,7 +150,7 @@ KPicoSim::KPicoSim() : TDEMainWindow( 0, "KPicoSim" )
m_messages->addColumn( "Line" ) ;
m_messages->addColumn( "Description" ) ;
m_messages->setSorting( -1, FALSE ) ;
m_messages->setSorting( -1, false ) ;
m_simulator->setMessageList( m_messages ) ;
m_simulationMode = false ;
@ -299,7 +299,7 @@ void KPicoSim::fileExportHEX()
this,
"Export HEX" ) ;
if ( filename != "" && compile() ) {
m_simulator->exportHEX( filename.ascii(), FALSE ) ;
m_simulator->exportHEX( filename.ascii(), false ) ;
}
}
@ -311,7 +311,7 @@ void KPicoSim::fileExportMEM()
this,
"Export MEM" ) ;
if ( filename != "" && compile() ) {
m_simulator->exportHEX( filename.ascii(), TRUE ) ;
m_simulator->exportHEX( filename.ascii(), true ) ;
}
}
@ -516,17 +516,17 @@ bool KPicoSim::compile()
m_messages->clear() ;
if ( !m_editor->save() )
return FALSE;
return false;
appendMessage( "File '" + m_editor->getFilename() + "' saved" ) ;
m_simulator->setFilename( m_editor->getFilename().ascii() ) ;
if ( m_simulator->compile() == TRUE ) {
if ( m_simulator->compile() == true ) {
appendMessage( "***Compile Success*** " ) ;
return TRUE ;
return true ;
} else {
appendMessage( "***Compile Failed*** " ) ;
return FALSE ;
return false ;
}
}
@ -543,7 +543,7 @@ void KPicoSim::startSim()
m_simulator->reset() ;
m_nrInstructions = 0 ;
m_simulationMode = TRUE ;
m_simulationMode = true ;
}
} else {
if ( m_simulator->isRunning() )
@ -553,7 +553,7 @@ void KPicoSim::startSim()
m_debugMenu->changeItem( START_SIM_ID, ldr->loadIcon( "system-run", TDEIcon::Small ), "Start Debug" ) ;
m_debugBar->setButton( START_SIM_ID, false ) ;
m_editor->clearExecutionMarker() ;
m_simulationMode = FALSE ;
m_simulationMode = false ;
}
if ( m_simulationMode ) {

@ -27,7 +27,7 @@ KSimulator::KSimulator(TQObject *parent, const char *name )
m_assembler->setCode( m_picoBlaze->code ) ;
m_timer = new TQTimer( this ) ;
m_bInterrupt = FALSE ;
m_bInterrupt = false ;
m_timer->stop() ;
m_run = false ;
@ -60,7 +60,7 @@ void KSimulator::clear()
void KSimulator::interrupt()
{
m_bInterrupt = TRUE ;
m_bInterrupt = true ;
}
unsigned int KSimulator::getNextSourceLine()
@ -71,7 +71,7 @@ unsigned int KSimulator::getNextSourceLine()
void KSimulator::next()
{
if ( m_bInterrupt ) {
m_bInterrupt = FALSE ;
m_bInterrupt = false ;
m_picoBlaze->Interrupt() ;
} else
m_picoBlaze->Next() ;
@ -99,9 +99,9 @@ unsigned char KSimulator::getFlags()
void KSimulator::setFlags( unsigned char flags )
{
m_picoBlaze->flags.carry = flags & CARRY_FLAG ? TRUE : FALSE ;
m_picoBlaze->flags.zero = flags & ZERO_FLAG ? TRUE : FALSE ;
m_picoBlaze->flags.interrupt_enable = flags & INTERRUPT_FLAG ? TRUE : FALSE ;
m_picoBlaze->flags.carry = flags & CARRY_FLAG ? true : false ;
m_picoBlaze->flags.zero = flags & ZERO_FLAG ? true : false ;
m_picoBlaze->flags.interrupt_enable = flags & INTERRUPT_FLAG ? true : false ;
}
void KSimulator::run()

@ -1,9 +1,3 @@
typedef unsigned char uint8_t ;
typedef unsigned short uint16_t ;
typedef unsigned int uint32_t ;
#define TRUE 1
#define FALSE 0

Loading…
Cancel
Save