do {
for (i=r->start_address; i<= r->end_address; i++) {
- if (i <= pic->maxRAMaddress) {
+ if ((i|alias) <= pic->maxRAMaddress) {
finalMapping[i | alias].isValid = 1;
finalMapping[i | alias].alias = r->alias;
finalMapping[i | alias].bank = r->bank;
} else {
finalMapping[i | alias].isSFR = 0;
}
+ } else {
+ fprintf(stderr, "WARNING: %s:%s memory at 0x%x is beyond max ram = 0x%x\n",
+ __FILE__,__FUNCTION__,(i|alias), pic->maxRAMaddress);
}
}
}
+/*-----------------------------------------------------------------*
+ *-----------------------------------------------------------------*/
int validAddress(int address, int reg_size)
{
int i;
return 1;
}
+/*-----------------------------------------------------------------*
+ *-----------------------------------------------------------------*/
void mapRegister(regs *reg)
{
}
+/*-----------------------------------------------------------------*
+ *-----------------------------------------------------------------*/
int assignRegister(regs *reg, int start_address)
{
int i;
return -1;
}
+/*-----------------------------------------------------------------*
+ *-----------------------------------------------------------------*/
void assignFixedRegisters(set *regset)
{
regs *reg;
}
+/*-----------------------------------------------------------------*
+ *-----------------------------------------------------------------*/
void assignRelocatableRegisters(set *regset, int used)
{
fprintf (of, "\tlist\tp=%s\n",&name[1]);
fprintf (of, "\t__CONFIG 0x%x\n",getConfigWord(0x2007));
+ fprintf (of, "\tradix dec");
fprintf (of, "\ninclude \"%s.inc\"\n",name);
}
/* Hardcoded flags to change the behavior of the PIC port */
static int peepOptimizing = 1; /* run the peephole optimizer if nonzero */
static int functionInlining = 1; /* inline functions if nonzero */
-int debug_verbose = 1; /* Set true to inundate .asm file */
+int debug_verbose = 0; /* Set true to inundate .asm file */
static int GpCodeSequenceNumber = 1;
int GpcFlowSeq = 1;
//pc->print(stderr,pc);
if(!(pcol && isPCOLAB(pcol))) {
- if((PCI(pc)->op != POC_RETLW) && (PCI(pc)->op != POC_RETURN) && (PCI(pc)->op != POC_CALL)) {
+ if((PCI(pc)->op != POC_RETLW) && (PCI(pc)->op != POC_RETURN) && (PCI(pc)->op != POC_CALL) && (PCI(pc)->op != POC_RETFIE) ) {
pc->print(stderr,pc);
fprintf(stderr, "ERROR: %s, branch instruction doesn't have label\n",__FUNCTION__);
}
{
/* First, get rid of registers that are used only one time */
- RemoveRegsFromSet(dynInternalRegs);
+ //RemoveRegsFromSet(dynInternalRegs);
RemoveRegsFromSet(dynAllocRegs);
RemoveRegsFromSet(dynStackRegs);
/*
addSet(&dynStackRegs,newReg(REG_STK, PO_GPR_TEMP,base_address++,NULL,1,0));
}
+/*-----------------------------------------------------------------*
+ *-----------------------------------------------------------------*/
regs *
allocProcessorRegister(int rIdx, char * name, short po_type, int alias)
{
return addSet(&dynProcessorRegs,newReg(REG_SFR, po_type, rIdx, name,1,alias));
}
+/*-----------------------------------------------------------------*
+ *-----------------------------------------------------------------*/
+
regs *
allocInternalRegister(int rIdx, char * name, short po_type, int alias)
{
- regs * reg = newReg(REG_SFR, po_type, rIdx, name,1,alias);
+ regs * reg = newReg(REG_GPR, po_type, rIdx, name,1,alias);
//fprintf(stderr,"allocInternalRegister %s addr =0x%x\n",name,rIdx);
if(reg) {
debugLog ("Dynamic Register not found\n");
- fprintf(stderr,"%s %d - requested register: 0x%x\n",__FUNCTION__,__LINE__,idx);
+ //fprintf(stderr,"%s %d - requested register: 0x%x\n",__FUNCTION__,__LINE__,idx);
werror (E_INTERNAL_ERROR, __FILE__, __LINE__,
"regWithIdx not found");
exit (1);
{
packBits(dynDirectBitRegs);
+
assignFixedRegisters(dynAllocRegs);
assignFixedRegisters(dynStackRegs);
assignFixedRegisters(dynDirectRegs);
#define __16F873
#include "p16f873.h"
+
+#define TESTLIT 0x05
+
unsigned char success=0;
unsigned char failures=0;
unsigned char dummy=0;
failures++;
}
+void m3(unsigned char uc)
+{
+ volatile unsigned char vuc;
+
+ // uchar = uchar * lit
+ // testing literal multiply with same source and destination
+ vuc = uc;
+ uc2 = 0;
+ uc1 = vuc; uc1 = uc1*1; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*2; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*3; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*4; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*5; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*6; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*7; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*8; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*9; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*10; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*11; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*12; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*13; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*14; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*15; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*16; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*17; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*18; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*19; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*20; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*21; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*22; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*23; if( uc1 != (uc2+=TESTLIT) ) failures++;
+ uc1 = vuc; uc1 = uc1*24; if( uc1 != (uc2+=TESTLIT) ) failures++;
+
+ uc1 = vuc; uc1 = uc1*31; if( uc1 != ((31*TESTLIT) & 0xff) ) failures++;
+ uc1 = vuc; uc1 = uc1*32; if( uc1 != ((32*TESTLIT) & 0xff) ) failures++;
+ uc1 = vuc; uc1 = uc1*64; if( uc1 != ((64*TESTLIT) & 0xff) ) failures++;
+ uc1 = vuc; uc1 = uc1*128;if( uc1 != ((128*TESTLIT)& 0xff) ) failures++;
+
+ // testing literal multiply with different source and destination
+ uc1 = vuc*1; if( uc1 != ((1*TESTLIT) & 0xff) ) failures++;
+ uc1 = vuc*2; if( uc1 != ((2*TESTLIT) & 0xff) ) failures++;
+ uc1 = vuc*4; if( uc1 != ((4*TESTLIT) & 0xff) ) failures++;
+}
+
+
void main(void)
{
dummy = 0;
ui3 = ui1*ui2; // uint = uint * unit
+ m3(TESTLIT);
success = failures;
done();
//unsigned bit bit1;
typedef unsigned char byte;
-data at 0x06 unsigned char PORTB;
+
byte uchar0;
const byte arr[] = { 1,2,8,9,0 };