From 5de3dd4762ca33a0f92e79ffa4fe2ff67069d531 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 24 Feb 2010 01:49:02 +0000 Subject: Added KDE3 version of ktechlab git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/ktechlab@1095338 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- src/micro/Makefile.am | 7 + src/micro/asminfo.cpp | 68 +++++++ src/micro/asminfo.h | 71 ++++++++ src/micro/microinfo.cpp | 62 +++++++ src/micro/microinfo.h | 64 +++++++ src/micro/microlibrary.cpp | 115 ++++++++++++ src/micro/microlibrary.h | 55 ++++++ src/micro/micropackage.cpp | 109 +++++++++++ src/micro/micropackage.h | 99 ++++++++++ src/micro/picinfo.cpp | 24 +++ src/micro/picinfo.h | 31 ++++ src/micro/picinfo12bit.cpp | 181 ++++++++++++++++++ src/micro/picinfo12bit.h | 112 ++++++++++++ src/micro/picinfo14bit.cpp | 446 +++++++++++++++++++++++++++++++++++++++++++++ src/micro/picinfo14bit.h | 330 +++++++++++++++++++++++++++++++++ src/micro/picinfo16bit.cpp | 345 +++++++++++++++++++++++++++++++++++ src/micro/picinfo16bit.h | 266 +++++++++++++++++++++++++++ 17 files changed, 2385 insertions(+) create mode 100644 src/micro/Makefile.am create mode 100644 src/micro/asminfo.cpp create mode 100644 src/micro/asminfo.h create mode 100644 src/micro/microinfo.cpp create mode 100644 src/micro/microinfo.h create mode 100644 src/micro/microlibrary.cpp create mode 100644 src/micro/microlibrary.h create mode 100644 src/micro/micropackage.cpp create mode 100644 src/micro/micropackage.h create mode 100644 src/micro/picinfo.cpp create mode 100644 src/micro/picinfo.h create mode 100644 src/micro/picinfo12bit.cpp create mode 100644 src/micro/picinfo12bit.h create mode 100644 src/micro/picinfo14bit.cpp create mode 100644 src/micro/picinfo14bit.h create mode 100644 src/micro/picinfo16bit.cpp create mode 100644 src/micro/picinfo16bit.h (limited to 'src/micro') diff --git a/src/micro/Makefile.am b/src/micro/Makefile.am new file mode 100644 index 0000000..37dc64f --- /dev/null +++ b/src/micro/Makefile.am @@ -0,0 +1,7 @@ +INCLUDES = $(all_includes) +METASOURCES = AUTO +noinst_LTLIBRARIES = libmicro.la +noinst_HEADERS = microinfo.h picinfo.h picinfo16bit.h picinfo14bit.h \ + picinfo12bit.h microlibrary.h asminfo.h +libmicro_la_SOURCES = microinfo.cpp picinfo.cpp picinfo16bit.cpp \ + picinfo14bit.cpp picinfo12bit.cpp microlibrary.cpp micropackage.cpp asminfo.cpp diff --git a/src/micro/asminfo.cpp b/src/micro/asminfo.cpp new file mode 100644 index 0000000..3a12b57 --- /dev/null +++ b/src/micro/asminfo.cpp @@ -0,0 +1,68 @@ +/*************************************************************************** + * Copyright (C) 2003,2005 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include "asminfo.h" + +#include + +AsmInfo::AsmInfo() +{ +} + + +AsmInfo::~AsmInfo() +{ +} + + +void AsmInfo::addInstruction( const QString & operand, const QString & description, const QString & opcode ) +{ + Instruction instruction; + instruction.operand = operand; + instruction.description = description; + instruction.opcode = opcode; + m_instructionList.append( instruction ); + m_operandList.append( operand ); +} + + +QString AsmInfo::setToString( Set set ) +{ + switch (set) + { + case AsmInfo::PIC12: + return "PIC12"; + + case AsmInfo::PIC14: + return "PIC14"; + + case AsmInfo::PIC16: + return "PIC16"; + } + + kdWarning() << k_funcinfo << "Unrecognized set="<portNames(); + else return ""; +} + +QStringList MicroInfo::pinIDs() +{ + if (m_package) return m_package->pinIDs(); + else return ""; +} + +QStringList MicroInfo::bidirPinIDs() +{ + if (m_package) return m_package->bidirPinIDs(); + else return ""; +} + +int MicroInfo::totalNumPins() +{ + if (m_package) return m_package->totalNumPins(); + else return 0; +} + +int MicroInfo::numIOPins() +{ + if (m_package) return m_package->numIOPins(); + else return 0; +} + +int MicroInfo::numIOPins( const QString &portName ) +{ + if (m_package) return m_package->numIOPins(portName); + else return 0; +} +#endif + diff --git a/src/micro/microinfo.h b/src/micro/microinfo.h new file mode 100644 index 0000000..7a22bf7 --- /dev/null +++ b/src/micro/microinfo.h @@ -0,0 +1,64 @@ +/*************************************************************************** + * Copyright (C) 2003-2004 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef MICROINFO_H +#define MICROINFO_H + +#include + +class AsmInfo; +class MicroPackage; + +/** +@author David Saxton +*/ +class MicroInfo +{ +public: + enum Support + { + FullSupport = 1 << 0, + PartialSupport = 1 << 1, + NoSupport = 1 << 2 + }; + enum { AllSupport = FullSupport | PartialSupport | NoSupport }; + + MicroInfo(); + virtual ~MicroInfo(); + + virtual AsmInfo * instructionSet() = 0; + /** + * Returns the gpsim emulator support status + */ + virtual Support gpsimSupport() const { return NoSupport; } + /** + * Returns the FlowCode support (i.e. constructing flowcode for the PIC) + */ + virtual Support flowcodeSupport() const { return NoSupport; } + /** + * Returns the Microbe support (i.e. compiling) + */ + virtual Support microbeSupport() const { return NoSupport; } + /** + * Returns a pointer to the Micro Package in use + */ + MicroPackage *package() const { return m_package; } + /** + * Returns an id unique to the Micro + */ + QString id() const { return m_id; } + +protected: + QString m_id; + MicroPackage *m_package; +}; + +#endif + diff --git a/src/micro/microlibrary.cpp b/src/micro/microlibrary.cpp new file mode 100644 index 0000000..f0faabc --- /dev/null +++ b/src/micro/microlibrary.cpp @@ -0,0 +1,115 @@ +/*************************************************************************** + * Copyright (C) 2003 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include "microinfo.h" +#include "microlibrary.h" + +#include +#include + +#include "picinfo12bit.h" +#include "picinfo14bit.h" +#include "picinfo16bit.h" + +#include "micropackage.h" + +MicroLibrary * MicroLibrary::m_pSelf = 0l; +static KStaticDeleter staticMicroLibraryDeleter; + +MicroLibrary * MicroLibrary::self() +{ + if ( !m_pSelf ) + staticMicroLibraryDeleter.setObject( m_pSelf, new MicroLibrary() ); + return m_pSelf; +} + +MicroLibrary::MicroLibrary() +{ + addMicroInfo( new PicInfo12C508() ); + addMicroInfo( new PicInfo12C509() ); + addMicroInfo( new PicInfo16C54 () ); + addMicroInfo( new PicInfo16C55() ); + addMicroInfo( new PicInfo16C61() ); + addMicroInfo( new PicInfo16C62() ); + addMicroInfo( new PicInfo16C63() ); + addMicroInfo( new PicInfo16C64() ); + addMicroInfo( new PicInfo16F627() ); + addMicroInfo( new PicInfo16F628() ); + addMicroInfo( new PicInfo16C65() ); + addMicroInfo( new PicInfo16C71() ); + addMicroInfo( new PicInfo16C72() ); + addMicroInfo( new PicInfo16C73() ); + addMicroInfo( new PicInfo16C712() ); + addMicroInfo( new PicInfo16C716() ); + addMicroInfo( new PicInfo16C74() ); + addMicroInfo( new PicInfo16C84() ); + addMicroInfo( new PicInfo16CR83() ); + addMicroInfo( new PicInfo16F83() ); + addMicroInfo( new PicInfo16CR84() ); + addMicroInfo( new PicInfo16F84() ); + addMicroInfo( new PicInfo16F873() ); + addMicroInfo( new PicInfo16F874() ); + addMicroInfo( new PicInfo16F877() ); + addMicroInfo( new PicInfo17C752() ); + addMicroInfo( new PicInfo17C756() ); + addMicroInfo( new PicInfo17C762() ); + addMicroInfo( new PicInfo17C766() ); + addMicroInfo( new PicInfo18C242() ); + addMicroInfo( new PicInfo18C252() ); + addMicroInfo( new PicInfo18C442() ); + addMicroInfo( new PicInfo18C452() ); + addMicroInfo( new PicInfo18F442() ); + addMicroInfo( new PicInfo18F452() ); +} + +MicroLibrary::~MicroLibrary() +{ + const MicroInfoList::iterator end = m_microInfoList.end(); + for ( MicroInfoList::iterator it = m_microInfoList.begin(); it != end; ++it ) + { + delete *it; + *it = 0l; + } +} + +MicroInfo * const MicroLibrary::microInfoWithID( QString id ) +{ + id = id.upper(); + const MicroInfoList::iterator end = m_microInfoList.end(); + for ( MicroInfoList::iterator it = m_microInfoList.begin(); it != end; ++it ) + { + if ( (*it)->id() == id ) return *it; + } + + return 0L; +} + +void MicroLibrary::addMicroInfo( MicroInfo *microInfo ) +{ + if (microInfo) + m_microInfoList += microInfo; +} + +QStringList MicroLibrary::microIDs( unsigned asmSet, unsigned gpsimSupport, unsigned flowCodeSupport, unsigned microbeSupport ) +{ + QStringList ids; + + const MicroInfoList::iterator end = m_microInfoList.end(); + for ( MicroInfoList::iterator it = m_microInfoList.begin(); it != end; ++it ) + { + MicroInfo * info = *it; + if ( (info->instructionSet()->set() & asmSet) && + (info->gpsimSupport() & gpsimSupport) && + (info->flowcodeSupport() & flowCodeSupport) && + (info->microbeSupport() & microbeSupport) ) + ids << info->id(); + } + return ids; +} diff --git a/src/micro/microlibrary.h b/src/micro/microlibrary.h new file mode 100644 index 0000000..537cf6c --- /dev/null +++ b/src/micro/microlibrary.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * Copyright (C) 2003-2005 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef MICRoLIBRARY_H +#define PICLIBRARY_H + +#include "asminfo.h" +#include "microinfo.h" + +#include +#include +#include + +class MicroInfo; +class MicroLibrary; +typedef QValueList MicroInfoList; + +inline MicroLibrary *microLibrary(); + +/** +@short Stores all the avaiable PICs (info) +@author David Saxton +*/ +class MicroLibrary +{ + public: + static MicroLibrary * self(); + + ~MicroLibrary(); + + MicroInfo * const microInfoWithID( QString id ); + void addMicroInfo( MicroInfo *microInfo ); + + /** + * Returns a list of micro ids with the given properties (OR'ed + * together). + */ + QStringList microIDs( unsigned asmSet = AsmInfo::AsmSetAll, unsigned gpsimSupport = MicroInfo::AllSupport, unsigned flowCodeSupport = MicroInfo::AllSupport, unsigned microbeSupport = MicroInfo::AllSupport ); + + private: + MicroLibrary(); + static MicroLibrary * m_pSelf; + + MicroInfoList m_microInfoList; + friend MicroLibrary *microLibrary(); +}; + +#endif diff --git a/src/micro/micropackage.cpp b/src/micro/micropackage.cpp new file mode 100644 index 0000000..9becbab --- /dev/null +++ b/src/micro/micropackage.cpp @@ -0,0 +1,109 @@ +/*************************************************************************** + * Copyright (C) 2003 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include "micropackage.h" + +#include + +PicPin::PicPin() +{ + pinID = "INVALID"; + type = PicPin::type_bidir; + portName = "INVALID"; + portPosition = -1; +} + + +PicPin::PicPin( const QString &_pinID, PicPin::pin_type _type, const QString &_portName, int _portPosition ) +{ + pinID = _pinID; + type = _type; + portName = _portName; + portPosition = _portPosition; +} + +MicroPackage::MicroPackage( const int pinCount ) +{ + m_numPins = pinCount; +} + +MicroPackage::~MicroPackage() +{ +} + +void MicroPackage::assignPin( int pinPosition, PicPin::pin_type type, const QString& pinID, const QString& portName, int portPosition ) +{ + if ( m_picPinMap.find(pinPosition) != m_picPinMap.end() ) + { + kdError() << "PicDevice::assignBidirPin: Attempting to reset pin "< +#include + +#include + +/** +@author David Saxton +*/ +class PicPin +{ +public: + enum pin_type + { + type_input = 0x1, // Input only pin + type_bidir = 0x2, // Bi-directional (input/output) + type_open = 0x4, // Open collector + type_vss = 0x8, // Voltage source + type_vdd = 0x10, // Voltage drain + type_mclr = 0x20, // Memory clear + type_osc = 0x40 // Oscillator + }; + + PicPin(); + PicPin( const QString &_pinID, PicPin::pin_type _type, const QString &_portName = "", int _portPosition = -1 ); + + PicPin::pin_type type; + + QString pinID; // Id of pin, eg 'MCLR' + + // For bidir (io) pins + QString portName; // Name of port, eg 'PORTA' + int portPosition; // Position in port +}; +typedef QMap PicPinMap; + +/** +@short Describes the PIC package (i.e. pins) +@author David Saxton +*/ +class MicroPackage +{ +public: + MicroPackage( const int pinCount ); + virtual ~MicroPackage(); + + /** + * Assigns a pin to a position in the package. + */ + void assignPin( int pinPosition, PicPin::pin_type type, const QString& pinID, const QString& portName = "", int portPosition = -1); + /** + * Returns the pins of the given type(s). If portName is not specified, all pins will be returned; + * not just those belonging to a given port. pin_type's can be OR'ed together + * e.g. pins( PicPin::type_input | PicPin::type_bidir, "PORTA" ) will return all bidirectional or + * input pins belonging to PORTA. If pinType is 0, then this will return all pins + */ + PicPinMap pins( uint pinType = 0, const QString& portName = "" ); + /** + * Returns just a QStringList of the pin ids. + * @see pins( uint pinType, const QString& portName ) + */ + QStringList pinIDs( uint pinType = 0, const QString& portName = "" ); + /** + * Returns the number of pins of the given type(s) (which can be OR'ed together), with the given + * port name if specified, while avoiding the construction of a new PicPinMap. if pinType is 0, + * then all pin types are considered + * @see pins + */ + int pinCount( uint pinType = 0, const QString& portName = "" ); + /** + * Returns a list of port names, eg 'PORTA', 'PORTB' for the package + */ + QStringList portNames() const { return m_portNames; } + /** + * Returns the number of ports + */ + uint portCount() const { return m_portNames.size(); } + +private: + PicPinMap m_picPinMap; + QStringList m_portNames; + int m_numPins; +}; + +#endif + + diff --git a/src/micro/picinfo.cpp b/src/micro/picinfo.cpp new file mode 100644 index 0000000..2e38c12 --- /dev/null +++ b/src/micro/picinfo.cpp @@ -0,0 +1,24 @@ +/*************************************************************************** + * Copyright (C) 2003-2004 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include "picinfo.h" + +PicInfo::PicInfo() + : MicroInfo() +{ + m_package = 0l; +} + + +PicInfo::~PicInfo() +{ +} + + diff --git a/src/micro/picinfo.h b/src/micro/picinfo.h new file mode 100644 index 0000000..cd9d155 --- /dev/null +++ b/src/micro/picinfo.h @@ -0,0 +1,31 @@ +/*************************************************************************** + * Copyright (C) 2003-2004 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef PICINFO_H +#define PICINFO_H + +#include "microinfo.h" + +/** +This is the base class for all 12bit, 14bit and 16bit PICs. +Thanks go to gpsim & Scott Dattalo for some of the the hierachal PIC class +structure used here :-) +@short Base class for all PICMicros +@author David Saxton +*/ +class PicInfo : public MicroInfo +{ + public: + PicInfo(); + virtual ~PicInfo(); + virtual AsmInfo * instructionSet() = 0; +}; + +#endif diff --git a/src/micro/picinfo12bit.cpp b/src/micro/picinfo12bit.cpp new file mode 100644 index 0000000..12f8dd5 --- /dev/null +++ b/src/micro/picinfo12bit.cpp @@ -0,0 +1,181 @@ +/*************************************************************************** + * Copyright (C) 2003-2004 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include "micropackage.h" +#include "picinfo12bit.h" + +#include +#include + +PicAsm12bit *PicAsm12bit::m_self = 0; +static KStaticDeleter staticDeleter; + +PicAsm12bit *PicAsm12bit::self() +{ + if ( !m_self ) staticDeleter.setObject( m_self, new PicAsm12bit() ); + return m_self; +} + + +PicInfo12bit::PicInfo12bit() + : PicInfo() +{ +} + + +PicInfo12bit::~PicInfo12bit() +{ +} + +PicAsm12bit::PicAsm12bit() + : AsmInfo() +{ + // Byte-orientated file register operations + addInstruction( "ADDWF", 0, "000111dfffff" ); + addInstruction( "ANDWF", 0, "000101dfffff" ); + addInstruction( "CLRF", 0, "0000011fffff" ); + addInstruction( "CLRW", 0, "000001000000" ); + addInstruction( "COMF", 0, "001001dfffff" ); + addInstruction( "DECF", 0, "000011dfffff" ); + addInstruction( "DECFSZ", 0, "001011dfffff" ); + addInstruction( "INCF", 0, "001010dfffff" ); + addInstruction( "INCFSZ", 0, "001111dfffff" ); + addInstruction( "IORWF", 0, "000100dfffff" ); + addInstruction( "MOVF", 0, "001000dfffff" ); + addInstruction( "MOVWF", 0, "0000001fffff" ); + addInstruction( "NOP", 0, "000000000000" ); + addInstruction( "RLF", 0, "001101dfffff" ); + addInstruction( "RRF", 0, "001100dfffff" ); + addInstruction( "SUBWF", 0, "000010dfffff" ); + addInstruction( "SWAPF", 0, "001110dfffff" ); + addInstruction( "XORWF", 0, "000110dfffff" ); + + // Bit-orientated file register operations + addInstruction( "BCF", 0, "0100bbbfffff" ); + addInstruction( "BSF", 0, "0101bbbfffff" ); + addInstruction( "BTFSC", 0, "0110bbbfffff" ); + addInstruction( "BTFSS", 0, "0111bbbfffff" ); + + // Literal and control operations + addInstruction( "ANDLW", 0, "1110kkkkkkkk" ); + addInstruction( "CALL", 0, "1001kkkkkkkk" ); + addInstruction( "CLRWDT", 0, "000000000100" ); + addInstruction( "GOTO", 0, "101kkkkkkkkk" ); + addInstruction( "IORLW", 0, "1101kkkkkkkk" ); + addInstruction( "MOVLW", 0, "1100kkkkkkkk" ); +// addInstruction( "RETFIE", 0, "00000000001001" ); + addInstruction( "OPTION", 0, "000000000010" ); + addInstruction( "RETLW", 0, "1000kkkkkkkk" ); +// addInstruction( "RETURN", 0, "00000000001000" ); + addInstruction( "SLEEP", 0, "000000000011" ); +// addInstruction( "SUBLW", 0, "11110xkkkkkkkk" ); + addInstruction( "TRIS", 0, "000000000fff" ); + addInstruction( "XORLW", 0, "1111kkkkkkkk" ); +} + + + +PicInfo16C54::PicInfo16C54() + : PicInfo12bit() +{ + m_id = "P16C54"; + + delete m_package; + m_package = new MicroPackage(18); + + m_package->assignPin( 17, PicPin::type_bidir, "RA0", "PORTA", 0 ); + m_package->assignPin( 18, PicPin::type_bidir, "RA1", "PORTA", 1 ); + m_package->assignPin( 1, PicPin::type_bidir, "RA2", "PORTA", 2 ); + m_package->assignPin( 2, PicPin::type_bidir, "RA3", "PORTA", 3 ); + m_package->assignPin( 3, PicPin::type_open, "RA4", "PORTA", 4 ); + + m_package->assignPin( 6, PicPin::type_bidir, "RB0", "PORTB", 0 ); + m_package->assignPin( 7, PicPin::type_bidir, "RB1", "PORTB", 1 ); + m_package->assignPin( 8, PicPin::type_bidir, "RB2", "PORTB", 2 ); + m_package->assignPin( 9, PicPin::type_bidir, "RB3", "PORTB", 3 ); + m_package->assignPin( 10, PicPin::type_bidir, "RB4", "PORTB", 4 ); + m_package->assignPin( 11, PicPin::type_bidir, "RB5", "PORTB", 5 ); + m_package->assignPin( 12, PicPin::type_bidir, "RB6", "PORTB", 6 ); + m_package->assignPin( 13, PicPin::type_bidir, "RB7", "PORTB", 7 ); + + m_package->assignPin( 4, PicPin::type_mclr, "MCLR" ); + m_package->assignPin( 5, PicPin::type_vss, "VSS" ); + m_package->assignPin( 14, PicPin::type_vdd, "VDD" ); + m_package->assignPin( 15, PicPin::type_osc, "OSC2" ); + m_package->assignPin( 16, PicPin::type_osc, "OSC1" ); +} + +PicInfo16C54::~PicInfo16C54() +{ + delete m_package; + m_package = 0l; +} + +PicInfo16C55::PicInfo16C55() + : PicInfo12bit() +{ + m_id = "P16C55"; +} +PicInfo16C55::~PicInfo16C55() +{ +} + + +PicInfo12C508::PicInfo12C508() + : PicInfo12bit() +{ + m_id = "P12C508"; + + delete m_package; + m_package = new MicroPackage(8); + + m_package->assignPin( 7, PicPin::type_bidir, "GP0", "GPIO", 0 ); + m_package->assignPin( 6, PicPin::type_bidir, "GP1", "GPIO", 1 ); + m_package->assignPin( 5, PicPin::type_bidir, "GP2", "GPIO", 2 ); + m_package->assignPin( 4, PicPin::type_input, "GP3", "GPIO", 3 ); + m_package->assignPin( 3, PicPin::type_bidir, "GP4", "GPIO", 4 ); + m_package->assignPin( 2, PicPin::type_bidir, "GP5", "GPIO", 5 ); + + m_package->assignPin( 8, PicPin::type_vss, "VSS" ); + m_package->assignPin( 1, PicPin::type_vdd, "VDD" ); +} +PicInfo12C508::~PicInfo12C508() +{ + delete m_package; + m_package = 0l; +} + +PicInfo12C509::PicInfo12C509() + : PicInfo12C508() +{ + m_id = "P12C509"; +} +PicInfo12C509::~PicInfo12C509() +{ +} + +PicInfo12C671::PicInfo12C671() + : PicInfo12C508() +{ + m_id = "P12C671"; +} +PicInfo12C671::~PicInfo12C671() +{ +} + +PicInfo12C672::PicInfo12C672() + : PicInfo12C508() +{ + m_id = "P12C672"; +} +PicInfo12C672::~PicInfo12C672() +{ +} + diff --git a/src/micro/picinfo12bit.h b/src/micro/picinfo12bit.h new file mode 100644 index 0000000..899bfc7 --- /dev/null +++ b/src/micro/picinfo12bit.h @@ -0,0 +1,112 @@ +/*************************************************************************** + * Copyright (C) 2003-2004 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef PICINFO12BIT_H +#define PICINFO12BIT_H + +#include "picinfo.h" +#include "asminfo.h" + +/** +@short 12 Bit PIC Instructions +@author David Saxton + */ +class PicAsm12bit : public AsmInfo +{ + public: + static PicAsm12bit *self(); + virtual Set set() const { return AsmInfo::PIC12; } + + protected: + static PicAsm12bit *m_self; + + private: + PicAsm12bit(); +}; + +/** +@author David Saxton + */ +class PicInfo12bit : public PicInfo +{ + public: + PicInfo12bit(); + ~PicInfo12bit(); + + virtual AsmInfo * instructionSet() { return PicAsm12bit::self(); } +}; + +/** +@author David Saxton + */ +class PicInfo16C54 : public PicInfo12bit +{ + public: + PicInfo16C54(); + ~PicInfo16C54(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C55 : public PicInfo12bit +{ + public: + PicInfo16C55(); + ~PicInfo16C55(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo12C508 : public PicInfo12bit +{ + public: + PicInfo12C508(); + ~PicInfo12C508(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo12C509 : public PicInfo12C508 +{ + public: + PicInfo12C509(); + ~PicInfo12C509(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo12C671 : public PicInfo12C508 +{ + public: + PicInfo12C671(); + ~PicInfo12C671(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo12C672 : public PicInfo12C508 +{ + public: + PicInfo12C672(); + ~PicInfo12C672(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +#endif diff --git a/src/micro/picinfo14bit.cpp b/src/micro/picinfo14bit.cpp new file mode 100644 index 0000000..9e75a92 --- /dev/null +++ b/src/micro/picinfo14bit.cpp @@ -0,0 +1,446 @@ +/*************************************************************************** + * Copyright (C) 2003-2004 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include "micropackage.h" +#include "picinfo14bit.h" + +#include +#include + +PicAsm14bit *PicAsm14bit::m_self = 0; +static KStaticDeleter staticDeleter; + +PicAsm14bit *PicAsm14bit::self() +{ + if ( !m_self ) staticDeleter.setObject( m_self, new PicAsm14bit() ); + return m_self; +} + + +PicInfo14bit::PicInfo14bit() + : PicInfo() +{ +} + + +PicInfo14bit::~PicInfo14bit() +{ +} + + +PicAsm14bit::PicAsm14bit() + : AsmInfo() +{ + // Byte-orientated file register operations + addInstruction( "ADDWF", 0, "000111dfffffff" ); + addInstruction( "ANDWF", 0, "000101dfffffff" ); + addInstruction( "CLRF", 0, "0000011fffffff" ); + addInstruction( "CLRW", 0, "0000010xxxxxxx" ); + addInstruction( "COMF", 0, "001001dfffffff" ); + addInstruction( "DECF", 0, "000011dfffffff" ); + addInstruction( "DECFSZ", 0, "001011dfffffff" ); + addInstruction( "INCF", 0, "001010dfffffff" ); + addInstruction( "INCFSZ", 0, "001111dfffffff" ); + addInstruction( "IORWF", 0, "000100dfffffff" ); + addInstruction( "MOVF", 0, "001000dfffffff" ); + addInstruction( "MOVWF", 0, "0000001fffffff" ); + addInstruction( "NOP", 0, "0000000xx00000" ); + addInstruction( "RLF", 0, "001101dfffffff" ); + addInstruction( "RRF", 0, "001100dfffffff" ); + addInstruction( "SUBWF", 0, "000010dfffffff" ); + addInstruction( "SWAPF", 0, "001110dfffffff" ); + addInstruction( "XORWF", 0, "000110dfffffff" ); + + // Bit-orientated file register operations + addInstruction( "BCF", 0, "0100bbbfffffff" ); + addInstruction( "BSF", 0, "0101bbbfffffff" ); + addInstruction( "BTFSC", 0, "0110bbbfffffff" ); + addInstruction( "BTFSS", 0, "0111bbbfffffff" ); + + // Literal and control operations + addInstruction( "ADDLW", 0, "11111xkkkkkkkk" ); + addInstruction( "ANDLW", 0, "111001kkkkkkkk" ); + addInstruction( "CALL", 0, "100kkkkkkkkkkk" ); + addInstruction( "CLRWDT", 0, "00000001100100" ); + addInstruction( "GOTO", 0, "101kkkkkkkkkkk" ); + addInstruction( "IORLW", 0, "111000kkkkkkkk" ); + addInstruction( "MOVLW", 0, "1100xxkkkkkkkk" ); + addInstruction( "RETFIE", 0, "00000000001001" ); + addInstruction( "RETLW", 0, "1101xxkkkkkkkk" ); + addInstruction( "RETURN", 0, "00000000001000" ); + addInstruction( "SLEEP", 0, "00000000000011" ); + addInstruction( "SUBLW", 0, "11110xkkkkkkkk" ); + addInstruction( "XORLW", 0, "111010kkkkkkkk" ); +} + +PicInfo16C8x::PicInfo16C8x() + : PicInfo14bit() +{ + delete m_package; + m_package = new MicroPackage(18); + + m_package->assignPin( 17, PicPin::type_bidir, "RA0", "PORTA", 0 ); + m_package->assignPin( 18, PicPin::type_bidir, "RA1", "PORTA", 1 ); + m_package->assignPin( 1, PicPin::type_bidir, "RA2", "PORTA", 2 ); + m_package->assignPin( 2, PicPin::type_bidir, "RA3", "PORTA", 3 ); + m_package->assignPin( 3, PicPin::type_open, "RA4", "PORTA", 4 ); + + m_package->assignPin( 6, PicPin::type_bidir, "RB0", "PORTB", 0 ); + m_package->assignPin( 7, PicPin::type_bidir, "RB1", "PORTB", 1 ); + m_package->assignPin( 8, PicPin::type_bidir, "RB2", "PORTB", 2 ); + m_package->assignPin( 9, PicPin::type_bidir, "RB3", "PORTB", 3 ); + m_package->assignPin( 10, PicPin::type_bidir, "RB4", "PORTB", 4 ); + m_package->assignPin( 11, PicPin::type_bidir, "RB5", "PORTB", 5 ); + m_package->assignPin( 12, PicPin::type_bidir, "RB6", "PORTB", 6 ); + m_package->assignPin( 13, PicPin::type_bidir, "RB7", "PORTB", 7 ); + + m_package->assignPin( 4, PicPin::type_mclr, "MCLR" ); + m_package->assignPin( 5, PicPin::type_vss, "VSS" ); + m_package->assignPin( 14, PicPin::type_vdd, "VDD" ); + m_package->assignPin( 15, PicPin::type_osc, "OSC2" ); + m_package->assignPin( 16, PicPin::type_osc, "OSC1" ); +} + +PicInfo16C8x::~PicInfo16C8x() +{ + delete m_package; + m_package = 0l; +} + +PicInfo16C84::PicInfo16C84() + : PicInfo16C8x() +{ + m_id = "P16C84"; +} +PicInfo16C84::~PicInfo16C84() +{ +} + +PicInfo16F84::PicInfo16F84() + : PicInfo16C8x() +{ + m_id = "P16F84"; +} +PicInfo16F84::~PicInfo16F84() +{ +} + +PicInfo16CR84::PicInfo16CR84() + : PicInfo16F84() +{ + m_id = "P16CR84"; +} +PicInfo16CR84::~PicInfo16CR84() +{ +} + +PicInfo16F83::PicInfo16F83() + : PicInfo16C8x() +{ + m_id = "P16F83"; +} +PicInfo16F83::~PicInfo16F83() +{ +} + +PicInfo16CR83::PicInfo16CR83() + : PicInfo16F83() +{ + m_id = "P16CR83"; +} +PicInfo16CR83::~PicInfo16CR83() +{ +} + +PicInfo16C61::PicInfo16C61() + : PicInfo16C8x() +{ + m_id = "P16C61"; +} +PicInfo16C61::~PicInfo16C61() +{ +} + +PicInfo16X6X::PicInfo16X6X() + : PicInfo14bit() +{ + m_id = "P16X6X"; +} +PicInfo16X6X::~PicInfo16X6X() +{ +} + +PicInfo16C62::PicInfo16C62() + : PicInfo16X6X() +{ + m_id = "P16C62"; + + delete m_package; + m_package = new MicroPackage(28); + + m_package->assignPin( 2, PicPin::type_bidir, "RA0", "PORTA", 0 ); + m_package->assignPin( 3, PicPin::type_bidir, "RA1", "PORTA", 1 ); + m_package->assignPin( 4, PicPin::type_bidir, "RA2", "PORTA", 2 ); + m_package->assignPin( 5, PicPin::type_bidir, "RA3", "PORTA", 3 ); + m_package->assignPin( 6, PicPin::type_open, "RA4", "PORTA", 4 ); + m_package->assignPin( 7, PicPin::type_bidir, "RA5", "PORTA", 5 ); + + m_package->assignPin( 21, PicPin::type_bidir, "RB0", "PORTB", 0 ); + m_package->assignPin( 22, PicPin::type_bidir, "RB1", "PORTB", 1 ); + m_package->assignPin( 23, PicPin::type_bidir, "RB2", "PORTB", 2 ); + m_package->assignPin( 24, PicPin::type_bidir, "RB3", "PORTB", 3 ); + m_package->assignPin( 25, PicPin::type_bidir, "RB4", "PORTB", 4 ); + m_package->assignPin( 26, PicPin::type_bidir, "RB5", "PORTB", 5 ); + m_package->assignPin( 27, PicPin::type_bidir, "RB6", "PORTB", 6 ); + m_package->assignPin( 28, PicPin::type_bidir, "RB7", "PORTB", 7 ); + + m_package->assignPin( 11, PicPin::type_bidir, "RC0", "PORTC", 0 ); + m_package->assignPin( 12, PicPin::type_bidir, "RC1", "PORTC", 1 ); + m_package->assignPin( 13, PicPin::type_bidir, "RC2", "PORTC", 2 ); + m_package->assignPin( 14, PicPin::type_bidir, "RC3", "PORTC", 3 ); + m_package->assignPin( 15, PicPin::type_bidir, "RC4", "PORTC", 4 ); + m_package->assignPin( 16, PicPin::type_bidir, "RC5", "PORTC", 5 ); + m_package->assignPin( 17, PicPin::type_bidir, "RC6", "PORTC", 6 ); + m_package->assignPin( 18, PicPin::type_bidir, "RC7", "PORTC", 7 ); + + m_package->assignPin( 1, PicPin::type_mclr, "MCLR" ); + m_package->assignPin( 8, PicPin::type_vss, "VSS" ); + m_package->assignPin( 9, PicPin::type_osc, "OSC1" ); + m_package->assignPin( 10, PicPin::type_osc, "OSC2" ); + m_package->assignPin( 19, PicPin::type_vss, "VSS" ); + m_package->assignPin( 20, PicPin::type_vdd, "VDD" ); +} +PicInfo16C62::~PicInfo16C62() +{ + delete m_package; + m_package = 0l; +} + +PicInfo16C63::PicInfo16C63() + : PicInfo16C62() +{ + m_id = "P16C63"; +} +PicInfo16C63::~PicInfo16C63() +{ +} + +PicInfo16C64::PicInfo16C64() + : PicInfo16X6X() +{ + m_id = "P16C64"; + + delete m_package; + m_package = new MicroPackage(40); + + m_package->assignPin( 2, PicPin::type_bidir, "RA0", "PORTA", 0 ); + m_package->assignPin( 3, PicPin::type_bidir, "RA1", "PORTA", 1 ); + m_package->assignPin( 4, PicPin::type_bidir, "RA2", "PORTA", 2 ); + m_package->assignPin( 5, PicPin::type_bidir, "RA3", "PORTA", 3 ); + m_package->assignPin( 6, PicPin::type_open, "RA4", "PORTA", 4 ); + m_package->assignPin( 7, PicPin::type_bidir, "RA5", "PORTB", 5 ); + + m_package->assignPin( 33, PicPin::type_bidir, "RB0", "PORTB", 0 ); + m_package->assignPin( 34, PicPin::type_bidir, "RB1", "PORTB", 1 ); + m_package->assignPin( 35, PicPin::type_bidir, "RB2", "PORTB", 2 ); + m_package->assignPin( 36, PicPin::type_bidir, "RB3", "PORTB", 3 ); + m_package->assignPin( 37, PicPin::type_bidir, "RB4", "PORTB", 4 ); + m_package->assignPin( 38, PicPin::type_bidir, "RB5", "PORTB", 5 ); + m_package->assignPin( 39, PicPin::type_bidir, "RB6", "PORTB", 6 ); + m_package->assignPin( 40, PicPin::type_bidir, "RB7", "PORTB", 7 ); + + m_package->assignPin( 15, PicPin::type_bidir, "RC0", "PORTC", 0 ); + m_package->assignPin( 16, PicPin::type_bidir, "RC1", "PORTC", 1 ); + m_package->assignPin( 17, PicPin::type_bidir, "RC2", "PORTC", 2 ); + m_package->assignPin( 18, PicPin::type_bidir, "RC3", "PORTC", 3 ); + m_package->assignPin( 23, PicPin::type_bidir, "RC4", "PORTC", 4 ); + m_package->assignPin( 24, PicPin::type_bidir, "RC5", "PORTC", 5 ); + m_package->assignPin( 25, PicPin::type_bidir, "RC6", "PORTC", 6 ); + m_package->assignPin( 26, PicPin::type_bidir, "RC7", "PORTC", 7 ); + + m_package->assignPin( 19, PicPin::type_bidir, "RD0", "PORTD", 0 ); + m_package->assignPin( 20, PicPin::type_bidir, "RD1", "PORTD", 1 ); + m_package->assignPin( 21, PicPin::type_bidir, "RD2", "PORTD", 2 ); + m_package->assignPin( 22, PicPin::type_bidir, "RD3", "PORTD", 3 ); + m_package->assignPin( 27, PicPin::type_bidir, "RD4", "PORTD", 4 ); + m_package->assignPin( 28, PicPin::type_bidir, "RD5", "PORTD", 5 ); + m_package->assignPin( 29, PicPin::type_bidir, "RD6", "PORTD", 6 ); + m_package->assignPin( 30, PicPin::type_bidir, "RD7", "PORTD", 7 ); + + m_package->assignPin( 8, PicPin::type_bidir, "RE0", "PORTE", 0 ); + m_package->assignPin( 9, PicPin::type_bidir, "RE1", "PORTE", 1 ); + m_package->assignPin( 10, PicPin::type_bidir, "RE2", "PORTE", 2 ); + + m_package->assignPin( 1, PicPin::type_mclr, "MCLR" ); + m_package->assignPin( 11, PicPin::type_vdd, "VDD" ); + m_package->assignPin( 12, PicPin::type_vss, "VSS" ); + m_package->assignPin( 13, PicPin::type_osc, "OSC1" ); + m_package->assignPin( 14, PicPin::type_osc, "OSC2" ); + m_package->assignPin( 31, PicPin::type_vss, "VSS" ); + m_package->assignPin( 32, PicPin::type_vdd, "VDD" ); +} +PicInfo16C64::~PicInfo16C64() +{ + delete m_package; + m_package = 0l; +} + +PicInfo16C65::PicInfo16C65() + : PicInfo16C64() +{ + m_id = "P16C65"; +} +PicInfo16C65::~PicInfo16C65() +{ +} + +PicInfo16F62x::PicInfo16F62x() + : PicInfo16X6X() +{ + m_id = "P16F62x"; + + delete m_package; + m_package = new MicroPackage(18); + + m_package->assignPin( 17, PicPin::type_bidir, "RA0", "PORTA", 0 ); + m_package->assignPin( 18, PicPin::type_bidir, "RA1", "PORTA", 1 ); + m_package->assignPin( 1, PicPin::type_bidir, "RA2", "PORTA", 2 ); + m_package->assignPin( 2, PicPin::type_bidir, "RA3", "PORTA", 3 ); + m_package->assignPin( 3, PicPin::type_bidir, "RA4", "PORTA", 4 ); + m_package->assignPin( 4, PicPin::type_input, "RA5", "PORTA", 5 ); + m_package->assignPin( 15, PicPin::type_bidir, "RA6", "PORTA", 6 ); + m_package->assignPin( 16, PicPin::type_bidir, "RA7", "PORTA", 7 ); + + m_package->assignPin( 6, PicPin::type_bidir, "RB0", "PORTB", 0 ); + m_package->assignPin( 7, PicPin::type_bidir, "RB1", "PORTB", 1 ); + m_package->assignPin( 8, PicPin::type_bidir, "RB2", "PORTB", 2 ); + m_package->assignPin( 9, PicPin::type_bidir, "RB3", "PORTB", 3 ); + m_package->assignPin( 10, PicPin::type_bidir, "RB4", "PORTB", 4 ); + m_package->assignPin( 11, PicPin::type_bidir, "RB5", "PORTB", 5 ); + m_package->assignPin( 12, PicPin::type_bidir, "RB6", "PORTB", 6 ); + m_package->assignPin( 13, PicPin::type_bidir, "RB7", "PORTB", 7 ); + + m_package->assignPin( 5, PicPin::type_vss, "VSS" ); + m_package->assignPin( 14, PicPin::type_vdd, "VDD" ); +} +PicInfo16F62x::~PicInfo16F62x() +{ + delete m_package; + m_package = 0l; +} + +PicInfo16F627::PicInfo16F627() + : PicInfo16F62x() +{ + m_id = "P16F627"; +} +PicInfo16F627::~PicInfo16F627() +{ +} + +PicInfo16F628::PicInfo16F628() + : PicInfo16F627() +{ + m_id = "P16F628"; +} +PicInfo16F628::~PicInfo16F628() +{ +} + +PicInfo16F648::PicInfo16F648() + : PicInfo16F628() +{ + m_id = "P16F648"; +} +PicInfo16F648::~PicInfo16F648() +{ +} + +PicInfo16C71::PicInfo16C71() + : PicInfo16C61() +{ + m_id = "P16C71"; +} +PicInfo16C71::~PicInfo16C71() +{ +} + +PicInfo16C712::PicInfo16C712() + : PicInfo16C62() +{ + m_id = "P16C712"; +} +PicInfo16C712::~PicInfo16C712() +{ +} + +PicInfo16C716::PicInfo16C716() + : PicInfo16C712() +{ + m_id = "P16C716"; +} +PicInfo16C716::~PicInfo16C716() +{ +} + +PicInfo16C72::PicInfo16C72() + : PicInfo16C62() +{ + m_id = "P16C72"; +} +PicInfo16C72::~PicInfo16C72() +{ +} + +PicInfo16C73::PicInfo16C73() + : PicInfo16C63() +{ + m_id = "P16C73"; +} +PicInfo16C73::~PicInfo16C73() +{ +} + +PicInfo16C74::PicInfo16C74() + : PicInfo16C65() +{ + m_id = "P16C74"; +} +PicInfo16C74::~PicInfo16C74() +{ +} + +PicInfo16F873::PicInfo16F873() + : PicInfo16C73() +{ + m_id = "P16F873"; +} +PicInfo16F873::~PicInfo16F873() +{ +} + +PicInfo16F874::PicInfo16F874() + : PicInfo16C74() +{ + m_id = "P16F874"; +} +PicInfo16F874::~PicInfo16F874() +{ +} + +PicInfo16F877::PicInfo16F877() + : PicInfo16F874() +{ + m_id = "P16F877"; +} +PicInfo16F877::~PicInfo16F877() +{ +} + diff --git a/src/micro/picinfo14bit.h b/src/micro/picinfo14bit.h new file mode 100644 index 0000000..4f20cb1 --- /dev/null +++ b/src/micro/picinfo14bit.h @@ -0,0 +1,330 @@ +/*************************************************************************** + * Copyright (C) 2003-2004 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef PICINFO14BIT_H +#define PICINFO14BIT_H + +#include "picinfo.h" +#include "asminfo.h" + +/** +@short 14 Bit PIC Instructions +@author David Saxton + */ +class PicAsm14bit : public AsmInfo +{ + public: + static PicAsm14bit *self(); + virtual Set set() const { return AsmInfo::PIC14; } + + protected: + static PicAsm14bit *m_self; + + private: + PicAsm14bit(); +}; + +/** +@author David Saxton + */ +class PicInfo14bit : public PicInfo +{ + public: + PicInfo14bit(); + ~PicInfo14bit(); + + virtual AsmInfo* instructionSet() { return PicAsm14bit::self(); } +}; + +/** +@author David Saxton + */ +class PicInfo16C8x : public PicInfo14bit +{ + public: + PicInfo16C8x(); + ~PicInfo16C8x(); +}; + +/** +@author David Saxton + */ +class PicInfo16C84 : public PicInfo16C8x +{ + public: + PicInfo16C84(); + ~PicInfo16C84(); + virtual Support gpsimSupport() const { return FullSupport; } + virtual Support microbeSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16F84 : public PicInfo16C8x +{ + public: + PicInfo16F84(); + ~PicInfo16F84(); + virtual Support gpsimSupport() const { return FullSupport; } + virtual Support flowcodeSupport() const { return FullSupport; } + virtual Support microbeSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16CR84 : public PicInfo16F84 +{ + public: + PicInfo16CR84(); + ~PicInfo16CR84(); + virtual Support gpsimSupport() const { return FullSupport; } + virtual Support flowcodeSupport() const { return NoSupport; } + virtual Support microbeSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16F83 : public PicInfo16C8x +{ + public: + PicInfo16F83(); + ~PicInfo16F83(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16CR83 : public PicInfo16F83 +{ + public: + PicInfo16CR83(); + ~PicInfo16CR83(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C61 : public PicInfo16C8x +{ + public: + PicInfo16C61(); + ~PicInfo16C61(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + + +/** +@author David Saxton + */ +class PicInfo16X6X : public PicInfo14bit +{ + public: + PicInfo16X6X(); + ~PicInfo16X6X(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C62 : public PicInfo16X6X +{ + public: + PicInfo16C62(); + ~PicInfo16C62(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C63 : public PicInfo16C62 +{ + public: + PicInfo16C63(); + ~PicInfo16C63(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C64 : public PicInfo16X6X +{ + public: + PicInfo16C64(); + ~PicInfo16C64(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C65 : public PicInfo16C64 +{ + public: + PicInfo16C65(); + ~PicInfo16C65(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16F62x : public PicInfo16X6X +{ + public: + PicInfo16F62x(); + ~PicInfo16F62x(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16F627 : public PicInfo16F62x +{ + public: + PicInfo16F627(); + ~PicInfo16F627(); + virtual Support gpsimSupport() const { return FullSupport; } + virtual Support flowcodeSupport() const { return PartialSupport; } + virtual Support microbeSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16F628 : public PicInfo16F627 +{ + public: + PicInfo16F628(); + ~PicInfo16F628(); + virtual Support gpsimSupport() const { return FullSupport; } + virtual Support flowcodeSupport() const { return PartialSupport; } + virtual Support microbeSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16F648 : public PicInfo16F628 +{ + public: + PicInfo16F648(); + ~PicInfo16F648(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C71 : public PicInfo16C61 +{ + public: + PicInfo16C71(); + ~PicInfo16C71(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C712 : public PicInfo16C62 +{ + public: + PicInfo16C712(); + ~PicInfo16C712(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C716 : public PicInfo16C712 +{ + public: + PicInfo16C716(); + ~PicInfo16C716(); + virtual Support gpsimSupport() const { return FullSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C72 : public PicInfo16C62 +{ + public: + PicInfo16C72(); + ~PicInfo16C72(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C73 : public PicInfo16C63 +{ + public: + PicInfo16C73(); + ~PicInfo16C73(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16C74 : public PicInfo16C65 +{ + public: + PicInfo16C74(); + ~PicInfo16C74(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16F873 : public PicInfo16C73 +{ + public: + PicInfo16F873(); + ~PicInfo16F873(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16F874 : public PicInfo16C74 +{ + public: + PicInfo16F874(); + ~PicInfo16F874(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo16F877 : public PicInfo16F874 +{ + public: + PicInfo16F877(); + ~PicInfo16F877(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +#endif diff --git a/src/micro/picinfo16bit.cpp b/src/micro/picinfo16bit.cpp new file mode 100644 index 0000000..cc7663f --- /dev/null +++ b/src/micro/picinfo16bit.cpp @@ -0,0 +1,345 @@ +/*************************************************************************** + * Copyright (C) 2003-2004 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#include "micropackage.h" +#include "picinfo16bit.h" + +#include +#include + +PicAsm16bit *PicAsm16bit::m_self = 0; +static KStaticDeleter staticDeleter; + +PicAsm16bit *PicAsm16bit::self() +{ + if ( !m_self ) staticDeleter.setObject( m_self, new PicAsm16bit() ); + return m_self; +} + +PicInfo16bit::PicInfo16bit() + : PicInfo() +{ +} + + +PicInfo16bit::~PicInfo16bit() +{ +} + + + +PicAsm16bit::PicAsm16bit() + : AsmInfo() +{ + // TODO 16 bit Asm instructions for PICs + + // Byte-orientated file register operations + addInstruction( "ADDWF", 0, "000111dfffffff" ); + addInstruction( "ANDWF", 0, "000101dfffffff" ); + addInstruction( "CLRF", 0, "0000011fffffff" ); + addInstruction( "CLRW", 0, "0000010xxxxxxx" ); + addInstruction( "COMF", 0, "001001dfffffff" ); + addInstruction( "DECF", 0, "000011dfffffff" ); + addInstruction( "DECFSZ", 0, "001011dfffffff" ); + addInstruction( "INCF", 0, "001010dfffffff" ); + addInstruction( "INCFSZ", 0, "001111dfffffff" ); + addInstruction( "IORWF", 0, "000100dfffffff" ); + addInstruction( "MOVF", 0, "001000dfffffff" ); + addInstruction( "MOVWF", 0, "0000001fffffff" ); + addInstruction( "NOP", 0, "0000000xx00000" ); + addInstruction( "RLF", 0, "001101dfffffff" ); + addInstruction( "RRF", 0, "001100dfffffff" ); + addInstruction( "SUBWF", 0, "000010dfffffff" ); + addInstruction( "SWAPF", 0, "001110dfffffff" ); + addInstruction( "XORWF", 0, "000110dfffffff" ); + + // Bit-orientated file register operations + addInstruction( "BCF", 0, "0100bbbfffffff" ); + addInstruction( "BSF", 0, "0101bbbfffffff" ); + addInstruction( "BTFSC", 0, "0110bbbfffffff" ); + addInstruction( "BTFSS", 0, "0111bbbfffffff" ); + + // Literal and control operations + addInstruction( "ADDLW", 0, "11111xkkkkkkkk" ); + addInstruction( "ANDLW", 0, "111001kkkkkkkk" ); + addInstruction( "CALL", 0, "100kkkkkkkkkkk" ); + addInstruction( "CLRWDT", 0, "00000001100100" ); + addInstruction( "GOTO", 0, "101kkkkkkkkkkk" ); + addInstruction( "IORLW", 0, "111000kkkkkkkk" ); + addInstruction( "MOVLW", 0, "1100xxkkkkkkkk" ); + addInstruction( "RETFIE", 0, "00000000001001" ); + addInstruction( "RETLW", 0, "1101xxkkkkkkkk" ); + addInstruction( "RETURN", 0, "00000000001000" ); + addInstruction( "SLEEP", 0, "00000000000011" ); + addInstruction( "SUBLW", 0, "11110xkkkkkkkk" ); + addInstruction( "XORLW", 0, "111010kkkkkkkk" ); +} + + +PicInfo17C7xx::PicInfo17C7xx() + : PicInfo16bit() +{ + m_id = "P17C7xx"; +} +PicInfo17C7xx::~PicInfo17C7xx() +{ +} + +PicInfo17C75x::PicInfo17C75x() + : PicInfo17C7xx() +{ + m_id = "P17C75x"; +} +PicInfo17C75x::~PicInfo17C75x() +{ +} + +PicInfo17C752::PicInfo17C752() + : PicInfo17C75x() +{ + m_id = "P17C752"; +} +PicInfo17C752::~PicInfo17C752() +{ +} + +PicInfo17C756::PicInfo17C756() + : PicInfo17C75x() +{ + m_id = "P17C756"; +} +PicInfo17C756::~PicInfo17C756() +{ +} + +PicInfo17C756A::PicInfo17C756A() + : PicInfo17C75x() +{ + m_id = "P17C756A"; +} +PicInfo17C756A::~PicInfo17C756A() +{ +} + +PicInfo17C762::PicInfo17C762() + : PicInfo17C75x() +{ + m_id = "P17C762"; +} +PicInfo17C762::~PicInfo17C762() +{ +} + +PicInfo17C766::PicInfo17C766() + : PicInfo17C75x() +{ + m_id = "P17C766"; +} +PicInfo17C766::~PicInfo17C766() +{ +} + +PicInfo18Cxx2::PicInfo18Cxx2() + : PicInfo16bit() +{ + m_id = "P18Cxx2"; +} +PicInfo18Cxx2::~PicInfo18Cxx2() +{ +} + +PicInfo18C2x2::PicInfo18C2x2() + : PicInfo16bit() +{ + m_id = "P18C2x2"; +} +PicInfo18C2x2::~PicInfo18C2x2() +{ +} + +PicInfo18C242::PicInfo18C242() + : PicInfo18C2x2() +{ + m_id = "P18C242"; +} +PicInfo18C242::~PicInfo18C242() +{ +} + +PicInfo18C252::PicInfo18C252() + : PicInfo18C242() +{ + m_id = "P18C252"; +} +PicInfo18C252::~PicInfo18C252() +{ +} + +PicInfo18C4x2::PicInfo18C4x2() + : PicInfo16bit() +{ + m_id = "P18C4x2"; + + delete m_package; + m_package = new MicroPackage(40); + + m_package->assignPin( 2, PicPin::type_bidir, "RA0", "PORTA", 0 ); + m_package->assignPin( 3, PicPin::type_bidir, "RA1", "PORTA", 1 ); + m_package->assignPin( 4, PicPin::type_bidir, "RA2", "PORTA", 2 ); + m_package->assignPin( 5, PicPin::type_bidir, "RA3", "PORTA", 3 ); + m_package->assignPin( 6, PicPin::type_open, "RA4", "PORTA", 4 ); + m_package->assignPin( 7, PicPin::type_bidir, "RA5", "PORTB", 5 ); + + m_package->assignPin( 33, PicPin::type_bidir, "RB0", "PORTB", 0 ); + m_package->assignPin( 34, PicPin::type_bidir, "RB1", "PORTB", 1 ); + m_package->assignPin( 35, PicPin::type_bidir, "RB2", "PORTB", 2 ); + m_package->assignPin( 36, PicPin::type_bidir, "RB3", "PORTB", 3 ); + m_package->assignPin( 37, PicPin::type_bidir, "RB4", "PORTB", 4 ); + m_package->assignPin( 38, PicPin::type_bidir, "RB5", "PORTB", 5 ); + m_package->assignPin( 39, PicPin::type_bidir, "RB6", "PORTB", 6 ); + m_package->assignPin( 40, PicPin::type_bidir, "RB7", "PORTB", 7 ); + + m_package->assignPin( 15, PicPin::type_bidir, "RC0", "PORTC", 0 ); + m_package->assignPin( 16, PicPin::type_bidir, "RC1", "PORTC", 1 ); + m_package->assignPin( 17, PicPin::type_bidir, "RC2", "PORTC", 2 ); + m_package->assignPin( 18, PicPin::type_bidir, "RC3", "PORTC", 3 ); + m_package->assignPin( 23, PicPin::type_bidir, "RC4", "PORTC", 4 ); + m_package->assignPin( 24, PicPin::type_bidir, "RC5", "PORTC", 5 ); + m_package->assignPin( 25, PicPin::type_bidir, "RC6", "PORTC", 6 ); + m_package->assignPin( 26, PicPin::type_bidir, "RC7", "PORTC", 7 ); + + m_package->assignPin( 19, PicPin::type_bidir, "RD0", "PORTD", 0 ); + m_package->assignPin( 20, PicPin::type_bidir, "RD1", "PORTD", 1 ); + m_package->assignPin( 21, PicPin::type_bidir, "RD2", "PORTD", 2 ); + m_package->assignPin( 22, PicPin::type_bidir, "RD3", "PORTD", 3 ); + m_package->assignPin( 27, PicPin::type_bidir, "RD4", "PORTD", 4 ); + m_package->assignPin( 28, PicPin::type_bidir, "RD5", "PORTD", 5 ); + m_package->assignPin( 29, PicPin::type_bidir, "RD6", "PORTD", 6 ); + m_package->assignPin( 30, PicPin::type_bidir, "RD7", "PORTD", 7 ); + + m_package->assignPin( 8, PicPin::type_bidir, "RE0", "PORTE", 0 ); + m_package->assignPin( 9, PicPin::type_bidir, "RE1", "PORTE", 1 ); + m_package->assignPin( 10, PicPin::type_bidir, "RE2", "PORTE", 2 ); + + m_package->assignPin( 1, PicPin::type_mclr, "MCLR" ); + m_package->assignPin( 11, PicPin::type_vdd, "VDD" ); + m_package->assignPin( 12, PicPin::type_vss, "VSS" ); + m_package->assignPin( 13, PicPin::type_osc, "OSC1" ); + m_package->assignPin( 14, PicPin::type_osc, "OSC2" ); + m_package->assignPin( 31, PicPin::type_vss, "VSS" ); + m_package->assignPin( 32, PicPin::type_vdd, "VDD" ); +} + +PicInfo18C4x2::~PicInfo18C4x2() +{ + delete m_package; + m_package = 0l; +} + +PicInfo18C442::PicInfo18C442() + : PicInfo18C4x2() +{ + m_id = "P18C442"; +} +PicInfo18C442::~PicInfo18C442() +{ +} + +PicInfo18C452::PicInfo18C452() + : PicInfo18C442() +{ + m_id = "P18C452"; +} +PicInfo18C452::~PicInfo18C452() +{ +} + +PicInfo18F442::PicInfo18F442() + : PicInfo18C442() +{ + m_id = "P18F442"; +} +PicInfo18F442::~PicInfo18F442() +{ +} + +PicInfo18F248::PicInfo18F248() + : PicInfo18F442() +{ + m_id = "P18F248"; +} +PicInfo18F248::~PicInfo18F248() +{ +} + +PicInfo18F452::PicInfo18F452() + : PicInfo18F442() +{ + m_id = "P18F452"; +} +PicInfo18F452::~PicInfo18F452() +{ +} + +PicInfo18Fxx20::PicInfo18Fxx20() + : PicInfo16bit() +{ + m_id = "P18Fxx20"; +} +PicInfo18Fxx20::~PicInfo18Fxx20() +{ +} + +PicInfo18F1220::PicInfo18F1220() + : PicInfo18Fxx20() +{ + m_id = "P18F1220"; + + delete m_package; + m_package = new MicroPackage(18); + + m_package->assignPin( 1, PicPin::type_bidir, "RA0", "PORTA", 0 ); + m_package->assignPin( 2, PicPin::type_bidir, "RA1", "PORTA", 1 ); + m_package->assignPin( 6, PicPin::type_bidir, "RA2", "PORTA", 2 ); + m_package->assignPin( 7, PicPin::type_bidir, "RA3", "PORTA", 3 ); + m_package->assignPin( 3, PicPin::type_open, "RA4", "PORTA", 4 ); + m_package->assignPin( 4, PicPin::type_open, "RA5", "PORTA", 5 ); + m_package->assignPin( 15, PicPin::type_open, "RA6", "PORTA", 6 ); + m_package->assignPin( 16, PicPin::type_open, "RA7", "PORTA", 7 ); + + m_package->assignPin( 8, PicPin::type_bidir, "RB0", "PORTB", 0 ); + m_package->assignPin( 9, PicPin::type_bidir, "RB1", "PORTB", 1 ); + m_package->assignPin( 17, PicPin::type_bidir, "RB2", "PORTB", 2 ); + m_package->assignPin( 18, PicPin::type_bidir, "RB3", "PORTB", 3 ); + m_package->assignPin( 10, PicPin::type_bidir, "RB4", "PORTB", 4 ); + m_package->assignPin( 11, PicPin::type_bidir, "RB5", "PORTB", 5 ); + m_package->assignPin( 12, PicPin::type_bidir, "RB6", "PORTB", 6 ); + m_package->assignPin( 13, PicPin::type_bidir, "RB7", "PORTB", 7 ); + + m_package->assignPin( 5, PicPin::type_vss, "VSS" ); + m_package->assignPin( 14, PicPin::type_vdd, "VDD" ); +} + +PicInfo18F1220::~PicInfo18F1220() +{ + delete m_package; + m_package = 0l; +} + +PicInfo18F1320::PicInfo18F1320() + : PicInfo18F1220() +{ + m_id = "P18F1320"; +} +PicInfo18F1320::~PicInfo18F1320() +{ +} + + diff --git a/src/micro/picinfo16bit.h b/src/micro/picinfo16bit.h new file mode 100644 index 0000000..975c23c --- /dev/null +++ b/src/micro/picinfo16bit.h @@ -0,0 +1,266 @@ +/*************************************************************************** + * Copyright (C) 2003-2004 by David Saxton * + * david@bluehaze.org * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + ***************************************************************************/ + +#ifndef PICINFO16BIT_H +#define PICINFO16BIT_H + +#include "picinfo.h" +#include "asminfo.h" + +/** +@short 16 Bit PIC Instructions +@author David Saxton + */ +class PicAsm16bit : public AsmInfo +{ + public: + static PicAsm16bit *self(); + virtual Set set() const { return AsmInfo::PIC16; } + + protected: + static PicAsm16bit *m_self; + + private: + PicAsm16bit(); +}; + +/** +@author David Saxton + */ +class PicInfo16bit : public PicInfo +{ + public: + PicInfo16bit(); + ~PicInfo16bit(); + + virtual AsmInfo * instructionSet() { return PicAsm16bit::self(); } +}; + +/** +@author David Saxton + */ +class PicInfo17C7xx : public PicInfo16bit +{ + public: + PicInfo17C7xx(); + ~PicInfo17C7xx(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo17C75x : public PicInfo17C7xx +{ + public: + PicInfo17C75x(); + ~PicInfo17C75x(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo17C752 : public PicInfo17C75x +{ + public: + PicInfo17C752(); + ~PicInfo17C752(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo17C756 : public PicInfo17C75x +{ + public: + PicInfo17C756(); + ~PicInfo17C756(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo17C756A : public PicInfo17C75x +{ + public: + PicInfo17C756A(); + ~PicInfo17C756A(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo17C762 : public PicInfo17C75x +{ + public: + PicInfo17C762(); + ~PicInfo17C762(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo17C766 : public PicInfo17C75x +{ + public: + PicInfo17C766(); + ~PicInfo17C766(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18Cxx2 : public PicInfo16bit +{ + public: + PicInfo18Cxx2(); + ~PicInfo18Cxx2(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18C2x2 : public PicInfo16bit +{ + public: + PicInfo18C2x2(); + ~PicInfo18C2x2(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18C242 : public PicInfo18C2x2 +{ + public: + PicInfo18C242(); + ~PicInfo18C242(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18C252 : public PicInfo18C242 +{ + public: + PicInfo18C252(); + ~PicInfo18C252(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18C4x2 : public PicInfo16bit +{ + public: + PicInfo18C4x2(); + ~PicInfo18C4x2(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18C442 : public PicInfo18C4x2 +{ + public: + PicInfo18C442(); + ~PicInfo18C442(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18C452 : public PicInfo18C442 +{ + public: + PicInfo18C452(); + ~PicInfo18C452(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18F442 : public PicInfo18C442 +{ + public: + PicInfo18F442(); + ~PicInfo18F442(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18F248 : public PicInfo18F442 +{ + public: + PicInfo18F248(); + ~PicInfo18F248(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18F452 : public PicInfo18F442 +{ + public: + PicInfo18F452(); + ~PicInfo18F452(); + virtual Support gpsimSupport() const { return PartialSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18Fxx20 : public PicInfo16bit +{ + public: + PicInfo18Fxx20(); + ~PicInfo18Fxx20(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18F1220 : public PicInfo18Fxx20 +{ + public: + PicInfo18F1220(); + ~PicInfo18F1220(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +/** +@author David Saxton + */ +class PicInfo18F1320 : public PicInfo18F1220 +{ + public: + PicInfo18F1320(); + ~PicInfo18F1320(); + virtual Support gpsimSupport() const { return NoSupport; } +}; + +#endif -- cgit v1.2.1