Thank you henk for your comment,
Yes, I'm assuming to have some external memory attached to the
processor.
But if you declare a variable as register you may not need any
external ram
eg.
void main(){
register char i;
register int *p;
p=1;
for(i=0;i<100;i++){
{
*p=(int)i;
}
}
In this case the compiler generate code that doesn't need any memory
attached to PicoBlaze :-)
If you still don't bealeve me, send me some code and I'll send you
back the code
generated by PicoC :-)
So, it depeand from the application... you can use the external memory
or not.
The compiler also tells you how much memory you need (if you need)
Unfortunatly I still have a lot work to do, but the compiler start to
be
working.
The version alpha will be read in few weeks time,(I still have some
bugs to fix)
I hope to fix some bugs in 2 or 3 week time, after that I will
appriciate
anyone could help me in the testing(I won't give the source)
Also, I want to say thanks to all the people that seems interested in
this project.
Francesco
henk@mediatronix.com (Henk van Kampen) wrote in message news:<23ecd97d.0411110331.2992002d@posting.google.com>...
> Francesco:
> Your compiler assumes memory is attached to the I/O port, which is
> usually not. When it is, it is mostly special purpose read or write
> only memory (registers) not fit for storing variables. The idea with a
> C compiler for Picoblaze is to have an intelligent use of the
> registers. In your example all variables should be registers. Only if
> needed you should offload variables to some scratchpad. The
> Picoblaze-3 core (KCPSM3.vhd) has a 64 byte scratchpad for that, with
> its own set of I/O instructions FETCH and STORE. Of course you must
> also be able to declare references to the I/O ports to control your
> attached hardware, which will then use INPUT and OUTPUT. A problem
> with Picoblaze in relation to a, say C, compiler is its inability to
> work with constant arrays (lookup tables, constant strings) and
> computed jumps, often you end up with lists of compare/branch lists.
> Otherwise Picoblaze is tiny yet powerful core to control all sorts of
> things in an FPGA design. Your C compiler, if more focussed on the
> typical use of Picoblaze, could nevertheless be very useful in using
> the core.
> Henk van Kampen
> see: www.mediatronix.com/tools
>
> francesco_poderico@yahoo.com (Francesco Poderico) wrote in message news:<1d6bc71.0411090836.21210d2b@posting.google.com>...
> > Hi all,
> > I'm designing a C compiler for the PicoBlaze processor.
> > The compiler is a subset of the C language, but is quite good.
> >
> > I called the C compiler PicoC :-)
> >
> > I'm an FPGA designer and I want to use this compiler for my job.
> > I think is very interesting to have a small microprocessor in an FPGA that
> > you can program in C!
> >
> >
> > Are you using PicoBlaze at moment?
> > do you think you can help me to test the Compiler?
> >
> > The compiler at moment gives working code, but I need someone to do some
> > good testing.
> >
> > I do not promise that I'll give the compiler to eveybody, but I'll give
> > the compiler to 5 or 10 people in all.
> >
> > Also,the compiler is in pre Alpha version.
> > That means that has not all the functionality.
> >
> > When the compiler will be finished I'll do some optimization on the generated code.
> >
> >
> > At moment I can write code like this:
> >
> >
> > EXAMPLE:
> >
> > int i;
> > int *ii;
> > char s;
> > char *ss;
> >
> > void main()
> > {
> > i =0;
> > for(i=0;i<0x123;i++){
> > s=1;
> > *ss=s;
> > do {s++;
> > *ss +=s;
> > }
> > while (*ss<100);
> > if(s)
> > i = 10;
> > else
> > i = 100;
> > }
> > ii = 1;
> > *ii = 1;
> > }
> >
> >
> > and when I lunch the PicoC compiler this is the result:
> >
> > CONSTANT _i_low , ff
> > CONSTANT _i_high , fe
> > CONSTANT _ii , fd
> > CONSTANT _s , fc
> > CONSTANT _ss , fb
> > LOAD S3 , fb
> >
> >
> >
> > ;int i;
> > ;int *ii;
> > ;char s;
> > ;char *ss;
> > ;void main()
> > _main:
> > ;{
> > ; i =0;
> > LOAD S5,00
> > LOAD S4,00
> > OUTPUT S5 , _i_low
> > OUTPUT S4 , _i_high
> > ; for(i=0;i<0x123;i++){
> > LOAD S5,00
> > LOAD S4,00
> > OUTPUT S5 , _i_low
> > OUTPUT S4 , _i_high
> > L2:
> > INPUT S1 , _i_low
> > INPUT S0 , _i_high
> > SUB S3 , 01
> > OUTPUT S0 , (S3)
> > SUB S3 , 01
> > OUTPUT S1 , (S3)
> > LOAD S5,23
> > LOAD S4,01
> > INPUT S1, (S3)
> > ADD S3 , 01
> > INPUT S0, (S3)
> > ADD S3 , 01
> > SUB S1 , S5
> > SUBCY S0, S4
> > JUMP C , L3
> > JUMP L5
> > JUMP L4
> > L3:
> > INPUT S5 , _i_low
> > INPUT S4 , _i_high
> > ADD S5 , 01
> > ADDCY S5 , 00
> > OUTPUT S5, _i_low
> > OUTPUT S4, _i_high
> > SUB S5 , 01
> > SUBCY S5 , 00
> > JUMP L2
> > L4:
> > ; s=1;
> > LOAD S5,01
> > OUTPUT S5 , _s
> > ; *ss=s;
> > INPUT S1 , _ss
> > INPUT S5 , _s
> > OUTPUT S5, (S1)
> > ; do {s++;
> > L6:
> > INPUT S5 , _s
> > ADD S5 , 01
> > OUTPUT S5, _s
> > SUB S5 , 01
> > ; *ss +=s;
> > INPUT S1 , _ss
> > INPUT S5, (S1)
> > SUB S3 , 01
> > OUTPUT S5 , (S3)
> > INPUT S5 , _s
> > INPUT S1, (S3)
> > ADD S3 , 01
> > ADD S1 , S5
> >
> > ; }
> > ; while (*ss<100);
> > L7:
> > INPUT S5 , _ss
> > INPUT S5, (S5)
> > SUB S3 , 01
> > OUTPUT S5 , (S3)
> > LOAD S5,64
> > INPUT S1, (S3)
> > ADD S3 , 01
> > SUB S1 , S5
> > JUMP C , L9
> > JUMP L8
> > L9:
> > JUMP L6
> > L8:
> > ; if(s)
> > INPUT S5 , _s
> > LOAD S4 , 00
> > OR S5 , S4
> > JUMP NZ , L10
> > JUMP L10
> > L11:
> > ; i = 10;
> > LOAD S5,0a
> > LOAD S4,00
> > OUTPUT S5 , _i_low
> > OUTPUT S4 , _i_high
> > ; else
> > JUMP L12
> > L10:
> > ; i = 100;
> > LOAD S5,64
> > LOAD S4,00
> > OUTPUT S5 , _i_low
> > OUTPUT S4 , _i_high
> > L12:
> > ; }
> > JUMP L3
> > L5:
> > ; ii = 1;
> > LOAD S5,01
> > LOAD S4,00
> > OUTPUT S5 , _ii
> > ; *ii = 1;
> > INPUT S1 , _ii
> > LOAD S5,01
> > LOAD S4,00
> > OUTPUT S5, (S1)
> > SUB S1 , 01
> > OUTPUT S4 , (S1)
> > ;}
> >
> >
> >
> >
> >
> > I hope someone of you is interested
> >
> > Regards,
> > Francesco