very promising !

General discussion on mikroPascal.
Post Reply
Author
Message
jpc
Posts: 1986
Joined: 22 Apr 2005 17:40
Location: France 87

very promising !

#1 Post by jpc » 08 Dec 2008 10:17

Out of curiosity i have been looking at the recently released MikroPascal for AVR compiler . It has not been a global test but i was interested to see how efficient accessing complex data is compared to the actual PIC compilers as i found some problems there in the past. From some project i extracted this little fragment that has no use by itself but is representative for the case i was looking at.

Code: Select all

program test;

{ Declarations section }
const spi_buffsize    : word =7;
type spi_channel_type  = record
                           head,
                           tail,
                           termflag,
                           match     : byte;
                           empty,
                           full      : boolean;
                           delimiter : string[5];
                           rx_buff,
                           tx_buff   : array[0..spi_buffsize] of byte;
                         end;

const
      max_slave       = 3;
      Crlf      : Array[3] Of Byte = (13,10,0);
var spi_channels : array[0..max_slave] of spi_channel_type;
    this_channel : ^spi_channel_type;
    spi_ik ,
    spi_channel ,i,j      : byte;
    spi_txbuff        : array[0..max_slave] of array[0..spi_buffsize] of byte;
    spi_rxbuff        : array[0..max_slave] of array[0..spi_buffsize] of byte;
    spi_txhead,
    spi_txtail,
    spi_rxhead,
    spi_rxtail        : array[0..max_slave]of byte;
    spi_termflag,
    spi_match         : array[0..spi_buffsize] of byte;

    spi_rxb_full      : array[0..max_slave] of boolean;




begin
  i := 2;
  j := 7;

 this_channel := @spi_channels[1];
 this_channel^.head := 7;
 this_channel^.tx_buff[j] := 'x';
 spi_rxbuff[i][j] := 'x';
end.
this executes on P18 in 130 CPU-cycles , the AVR needs only 58 cycles.
the generated code is very different , the actual PIC compiler needs math-library code to calculate the pointer which makes also huge difference on the required ROM, 1818 for the PIC , only 260 for the AVR.
It looks like we can expect a great step forward !

Post Reply

Return to “mikroPascal General”