#include <pic14.h>
Collaboration diagram for PIC14:

Public Types | |
| enum | Type { P16C84, P16F84, P16F627, P16F628, unknown } |
| enum | LocationType { num = 1, work = 2, var = 3 } |
| enum | DelaySubroutine { Delay_None = 0, Delay_3uS = 1, Delay_768uS = 2, Delay_200mS = 3, Delay_50S = 4 } |
Public Member Functions | |
| PIC14 (Microbe *master, Type type) | |
| ~PIC14 () | |
| Type | type () const |
| QString | minimalTypeString () const |
| PortPin | toPortPin (const QString &portPinString) |
| uchar | gprStart () const |
| void | setParser (Parser *parser) |
| void | setCode (Code *code) |
| void | mergeCode (Code *code) |
| void | setConditionalCode (Code *ifCode, Code *elseCode) |
| Code * | ifCode () |
| Code * | elseCode () |
| void | postCompileConstruct (const QStringList &interrupts) |
| bool | isValidPort (const QString &portName) const |
| bool | isValidPortPin (const PortPin &portPin) const |
| bool | isValidTris (const QString &trisName) const |
| bool | isValidInterrupt (const QString &interruptName) const |
| void | Sgoto (const QString &label) |
| void | Slabel (const QString &label) |
| void | Send () |
| void | Ssubroutine (const QString &procName, Code *compiledProcCode) |
| void | Sinterrupt (const QString &procName, Code *compiledProcCode) |
| void | Scall (const QString &name) |
| void | Ssetlh (const PortPin &portPin, bool high) |
| void | add (QString val1, QString val2, LocationType val1Type, LocationType val2Type) |
| void | subtract (const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type) |
| void | mul (QString val1, QString val2, LocationType val1Type, LocationType val2Type) |
| void | div (const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type) |
| void | assignNum (const QString &val) |
| void | assignVar (const QString &val) |
| void | saveToReg (const QString &dest) |
| void | saveResultToVar (const QString &var) |
| void | equal (const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type) |
| void | notEqual (const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type) |
| void | greaterThan (const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type) |
| void | lessThan (const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type) |
| void | greaterOrEqual (const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type) |
| void | lessOrEqual (const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type) |
| void | bitwise (Expression::Operation op, const QString &val1, const QString &val2, bool val1IsNum, bool val2IsNum) |
| void | Swhile (Code *whileCode, const QString &expression) |
| void | Srepeat (Code *repeatCode, const QString &expression) |
| void | Sif (Code *ifCode, Code *elseCode, const QString &expression) |
| void | Sfor (Code *forCode, Code *initCode, const QString &expression, const QString &variable, const QString &step, bool stepPositive) |
| void | Spin (const PortPin &portPin, bool NOT) |
| void | addCommonFunctions (DelaySubroutine delay) |
| void | Sdelay (unsigned length_us, Code::InstructionPosition pos=Code::Middle) |
| void | SsevenSegment (const Variable &pinMap) |
| void | Skeypad (const Variable &pinMap) |
| void | SincVar (const QString &var) |
| void | SdecVar (const QString &var) |
| void | SrotlVar (const QString &var) |
| void | SrotrVar (const QString &var) |
| void | Stristate (const QString &port) |
| void | Sasm (const QString &raw) |
Static Public Member Functions | |
| static Type | toType (const QString &text) |
Public Attributes | |
| Code * | m_ifCode |
| Code * | m_elseCode |
Protected Member Functions | |
| void | multiply () |
| void | divide () |
| void | ifInitCode (const QString &val1, const QString &val2, LocationType val1Type, LocationType val2Type) |
| void | rearrangeOpArguments (QString *val1, QString *val2, LocationType *val1Type, LocationType *val2Type) |
| int | interruptNameToBit (const QString &name, bool flag) |
Protected Attributes | |
| Type | m_type |
| Parser * | m_parser |
| Microbe * | mb |
| Code * | m_pCode |
Definition at line 70 of file pic14.h.
| PIC14::Type PIC14::toType | ( | const QString & | text | ) | [static] |
Tries to convert the string to a PIC type, returning unknown if unsuccessful.
Definition at line 122 of file pic14.cpp.
Referenced by Microbe::compile().
| Type PIC14::type | ( | ) | const [inline] |
| QString PIC14::minimalTypeString | ( | ) | const |
Definition at line 143 of file pic14.cpp.
References m_type.
Referenced by Code::generateCode().
| PortPin PIC14::toPortPin | ( | const QString & | portPinString | ) |
Translates the portPinString (e.g. "PORTA.2") into a PortPin if the port and pin combination is valid (otherwise returns an invalid PortPin with a pin of -1.
Definition at line 65 of file pic14.cpp.
References isValidPortPin().
Referenced by Parser::processAssignment().
| uchar PIC14::gprStart | ( | ) | const |
Returns the address that the General Purpose Registers starts at.
Definition at line 101 of file pic14.cpp.
References m_type.
Referenced by Code::generateCode().
| bool PIC14::isValidPort | ( | const QString & | portName | ) | const |
Definition at line 252 of file pic14.cpp.
Referenced by Parser::processAssignment().
| bool PIC14::isValidPortPin | ( | const PortPin & | portPin | ) | const |
Definition at line 259 of file pic14.cpp.
References PortPin::pin(), and PortPin::port().
Referenced by toPortPin().
| void PIC14::saveResultToVar | ( | const QString & | var | ) |
Move the contents of the working register to the register with the given name.
Definition at line 410 of file pic14.cpp.
References Code::append(), and m_pCode.
Referenced by Parser::processAssignment(), and Stristate().
| void PIC14::equal | ( | const QString & | val1, | |
| const QString & | val2, | |||
| LocationType | val1Type, | |||
| LocationType | val2Type | |||
| ) |
Code for "=="
Definition at line 587 of file pic14.cpp.
References Code::append(), elseCode(), ifCode(), ifInitCode(), m_pCode, mb, mergeCode(), Code::queueLabel(), and Microbe::uniqueLabel().
| void PIC14::notEqual | ( | const QString & | val1, | |
| const QString & | val2, | |||
| LocationType | val1Type, | |||
| LocationType | val2Type | |||
| ) |
Code for "!="
Definition at line 605 of file pic14.cpp.
References Code::append(), elseCode(), ifCode(), ifInitCode(), m_pCode, mb, mergeCode(), Code::queueLabel(), and Microbe::uniqueLabel().
| void PIC14::greaterThan | ( | const QString & | val1, | |
| const QString & | val2, | |||
| LocationType | val1Type, | |||
| LocationType | val2Type | |||
| ) |
Code for ">"
Definition at line 623 of file pic14.cpp.
References Code::append(), elseCode(), ifCode(), ifInitCode(), m_pCode, mb, mergeCode(), Code::queueLabel(), and Microbe::uniqueLabel().
| void PIC14::lessThan | ( | const QString & | val1, | |
| const QString & | val2, | |||
| LocationType | val1Type, | |||
| LocationType | val2Type | |||
| ) |
Code for "<"
Definition at line 640 of file pic14.cpp.
References Code::append(), elseCode(), ifCode(), ifInitCode(), m_pCode, mb, mergeCode(), Code::queueLabel(), and Microbe::uniqueLabel().
| void PIC14::greaterOrEqual | ( | const QString & | val1, | |
| const QString & | val2, | |||
| LocationType | val1Type, | |||
| LocationType | val2Type | |||
| ) |
Code for ">="
Definition at line 661 of file pic14.cpp.
References Code::append(), elseCode(), ifCode(), ifInitCode(), m_pCode, mb, mergeCode(), Code::queueLabel(), and Microbe::uniqueLabel().
| void PIC14::lessOrEqual | ( | const QString & | val1, | |
| const QString & | val2, | |||
| LocationType | val1Type, | |||
| LocationType | val2Type | |||
| ) |
Code for "<="
Definition at line 681 of file pic14.cpp.
References Code::append(), elseCode(), ifCode(), ifInitCode(), m_pCode, mb, mergeCode(), Code::queueLabel(), and Microbe::uniqueLabel().
| void PIC14::Sdelay | ( | unsigned | length_us, | |
| Code::InstructionPosition | pos = Code::Middle | |||
| ) |
Delay the program execution, for the given period of length_us (unit: microseconds).
| pos | the position to add the code for calling the delay subroutine. |
Definition at line 791 of file pic14.cpp.
References Microbe::addDelayRoutineWanted(), Code::append(), m_pCode, and mb.
Referenced by Skeypad().
| void PIC14::SsevenSegment | ( | const Variable & | pinMap | ) |
Output the working register to the given seven segment.
| name | The variable giving the pin configuration of the seven segment. |
Definition at line 895 of file pic14.cpp.
References Code::append(), Code::instruction(), m_pCode, Variable::name(), Variable::portPinList(), Code::queueLabel(), Code::Subroutine, and Variable::type().
Referenced by Parser::processAssignment().
| void PIC14::Skeypad | ( | const Variable & | pinMap | ) |
Read the value of the keypad to the working register.
| name | The variable giving the pin configuration of the keypad. |
Definition at line 1016 of file pic14.cpp.
References Microbe::alias(), Code::append(), Code::instruction(), m_pCode, mb, Variable::name(), Variable::portPinList(), Code::queueLabel(), Sdelay(), Code::Subroutine, and Variable::type().
| void PIC14::rearrangeOpArguments | ( | QString * | val1, | |
| QString * | val2, | |||
| LocationType * | val1Type, | |||
| LocationType * | val2Type | |||
| ) | [protected] |
| int PIC14::interruptNameToBit | ( | const QString & | name, | |
| bool | flag | |||
| ) | [protected] |
| flag | True means give flag bit, false means give enable bit instead |
Definition at line 228 of file pic14.cpp.
Referenced by postCompileConstruct(), and Sinterrupt().
Type PIC14::m_type [protected] |
Definition at line 232 of file pic14.h.
Referenced by gprStart(), isValidInterrupt(), minimalTypeString(), PIC14(), and type().
1.5.1