FPGARelated.com
Forums

ANN: PicoBlaze C: compile to bitstream!

Started by Antti Lukats December 19, 2006
PicoBlaze C compiler has been available for some time already,
but until yesterday I never tried it.
But today when I type:

>start build.bat
then the following C file ----- cut ----- // This is first PCCOMP Program tested on MicroFpga! // Target was S3-200 with KCPSM3_256S MF-Core #include "..\inc\padmap.h" #include "..\inc\board.h" #include "..\lib\pinapi.h" unsigned int i; // Delay void ledelay() { for (i=0;i<65000;i++) {} } void main() { // blink a LED forever ! while (1) { SetPin(LED1, 0); ledelay(); SetPin(LED1, 1); ledelay(); } } ----- cut ----- generates a BIT file (without invoking synthesis or fpga implementation tools) and there is LED blinking on my desk right this moment :) KCSPM3_256S core only supports maximum 256 FPGA I/Os but its still fun the evaluation package is ready for download http://www.microfpga.com/joomla/index.php?option=com_remository&Itemid=27&func=fileinfo&id=3 it includes the MicroFpga bitstreams and compile scripts devices included: xc2v1000_fg256 xc2v250_cs144 xc2v250_fg256 xc2v250_fg456 xc2v40_cs144 xc2v40_fg256 xc2v500_fg256 xc2v80_cs144 xc2v80_fg256 xc2vp2_ff672 xc2vp2_fg256 xc2vp2_fg456 xc2vp4_fg256 xc2vp4_fg456 xc2vp7_fg456 xc3s1000_fg320 xc3s1000_ft256 xc3s200_ft256 xc3s200_pq208 xc3s200_tq144 xc3s200_vq100 xc3s400_fg320 xc3s400_ft256 xc3s400_pq208 xc3s400_tq144 xc3s50_cp132 xc3s50_pq208 xc3s50_tq144 xc3s50_vq100 xc4vfx12_sf363 xc4vlx15_sf363 xc4vlx25_sf363 note: MicroFpga is useable on linux too, but PCCOMP and KCPSM3 are only available for windows platform - on linux the java based picoblaze assembler should be used (we have no scripts or support for that at the moment) Antti PS MicroBlaze based MicroFgpa packages are are also ready but will be released a little later.
Antti Lukats wrote:

> PicoBlaze C compiler has been available for some time already, > but until yesterday I never tried it. > But today when I type: > the evaluation package is ready for download
<snip>
> > http://www.microfpga.com/joomla/index.php?option=com_remository&Itemid=27&func=fileinfo&id=3
Interesting, but light on specifics :) Which PicoBlaze C is this using, and what other tools do the bitstream insertion ? Up to what Code size ? -jg
"Jim Granville" <no.spam@designtools.maps.co.nz> schrieb im Newsbeitrag 
news:45885149$1@clear.net.nz...
> Antti Lukats wrote: > >> PicoBlaze C compiler has been available for some time already, >> but until yesterday I never tried it. >> But today when I type: >> the evaluation package is ready for download > <snip> >> >> http://www.microfpga.com/joomla/index.php?option=com_remository&Itemid=27&func=fileinfo&id=3 > > Interesting, but light on specifics :) > > Which PicoBlaze C is this using, and what other tools do the bitstream > insertion ? Up to what Code size ? > > -jg >
Hi Jim, original PCCOMP is used to generate the object file for the KCPSM3 so pccomp generates assembly for kcpsm3.exe that emits hex or actually "MEM" directly suitable for DATA2MEM so only vendor tool used is really only data2mem - there is open-source project in progress to offer 3rd party data2mem like services so it could be that the all process to final bitstream uses no vendor supplied tools at all. .. kcpsm3 has 1k word code size this version is only 'get it going with PicoBlaze' version - the main reason why I did is was the wish to support _all_ Xilinx FPGA starting from XC2S15 in all spartan3, virtex-2/P/4/5 based systems an MicroBlaze is already useable. sorry for sparse docs - I was just little impressed to see the picoblaze c compiler to be working in action so I packaged the stuff and made available for downloads the actual documentation is being prepared as well, and will be released when microblaze based system are ready to release Antti
"Antti Lukats" <antti@openchip.org> wrote:

>PicoBlaze C compiler has been available for some time already, >but until yesterday I never tried it. >But today when I type: > >>start build.bat > >then the following C file > >----- cut ----- >// This is first PCCOMP Program tested on MicroFpga! >// Target was S3-200 with KCPSM3_256S MF-Core > >#include "..\inc\padmap.h" >#include "..\inc\board.h" >#include "..\lib\pinapi.h" > >unsigned int i; > >// Delay >void ledelay() { for (i=0;i<65000;i++) {} } > >void main() >{ > // blink a LED forever ! > while (1) { > SetPin(LED1, 0); ledelay(); > SetPin(LED1, 1); ledelay(); > } >}
What I'm really interested in is whether the assembly code generated by the compiler is well optimized or not. Can you post the generated assembly code? -- Reply to nico@nctdevpuntnl (punt=.) Bedrijven en winkels vindt U op www.adresboekje.nl
Nico Coesel schrieb:

> "Antti Lukats" <antti@openchip.org> wrote: > > >PicoBlaze C compiler has been available for some time already, > >but until yesterday I never tried it. > >But today when I type: > > > What I'm really interested in is whether the assembly code generated > by the compiler is well optimized or not. Can you post the generated > assembly code? >
no. the PicoBlaze C compiler is not very optimizing. so dont expect miracles. but still it was fun to see that it is useable and produces working code. if you want to test out you can download the PCCOMP from the authors site or download the MicroFpga demo package where it is included, the script there deletes all interim files, so just uncomment the call kcspm3_clean.bat and you will have the assembly file left in place i have written one REALLY optimizing risc compiler once, it was pretty hard task as I wanted the compiler to take advantage of all the resources the best way actually i have partially ported that compiler to produce picoblaze code, but that isnt finished, maybe/hopefully i have time to revise my compiler, but no promises right now Antti
"Antti" <Antti.Lukats@xilant.com> wrote:

>Nico Coesel schrieb: > >> "Antti Lukats" <antti@openchip.org> wrote: >> >> >PicoBlaze C compiler has been available for some time already, >> >but until yesterday I never tried it. >> >But today when I type: >> > >> What I'm really interested in is whether the assembly code generated >> by the compiler is well optimized or not. Can you post the generated >> assembly code? >> > >no. >the PicoBlaze C compiler is not very optimizing. so dont expect >miracles. but still it was fun to see that it is useable and produces >working code. if you want to test out you can download the PCCOMP from >the authors site or download the MicroFpga demo package where it is >included, the script there deletes all interim files, so just uncomment
Antti, Just a comment: I've looked around your website a bit, but I can't really figure out what MicroFpga (which is your product?) is intended to do and how it may help me. -- Reply to nico@nctdevpuntnl (punt=.) Bedrijven en winkels vindt U op www.adresboekje.nl
Hi Antti,

I like what you have done and are trying to do with MicroFPGA. Nice
idea!

I downloaded your MicroFPGA test-package but I can't get it working
correctly. As I understand the clock used are created by some kind of
internal DDS of something? Can you explain this further?  Can this give
problems with differnet circuits?

I tried out both the build.bat for the assembler-example and the
build.bat for the C-example. Both of them create a download.bit but
when downloading them using Impact no LED is blinking.

I use:
Windows XP
Spartan3-Starter Kit 200K from Digilent and also pointed out both the
correct circuit
(xc3s200_ft256) AND the correct board (digilent\s3sk)
ISE v8.1 - Impact for download, and the standard Parallell-JTAG cable
that came with the kit!

I also changed the assembler code to reflect the correct pins for my
board:

-snip-
...
		OUTPUT ON,  pad_K12
		OUTPUT OFF, pad_P14
		OUTPUT OFF, pad_L12
		OUTPUT ON,  pad_N14

		OUTPUT OFF, pad_P13
		OUTPUT ON,  pad_N12
		OUTPUT OFF, pad_P12
		OUTPUT ON,  pad_P11
swloop:


		OUTPUT ON,  pad_K12
		CALL ledelay

		OUTPUT OFF,  pad_K12
		CALL ledelay
-snip-

A note is that the "prepare.bat"-file uses direct-path to the
xilinx82-environment and for me that is using xilinx81 I must manually
go in and change it and it did not indicate any errors before doing
this either. Use the %XILINX% environment variable instead in some
smart way. I've changed it to suit me, but this didn't fix the
problem..

Do you have any ideas what could be wrong with my setup? The end-result
is that the board indicates a correctly download-procedure by lighting
the green LED next to the "PROG DONE" button. How should the RESET be
handled within Impact? Now it automatically starts (try to start) after
the programming has finished.

Keep on working on the tool and I'll keep on testing it and reporting
back!

Best Regards
Magnus


Antti Lukats wrote:
> PicoBlaze C compiler has been available for some time already, > but until yesterday I never tried it. > But today when I type: > > >start build.bat > > then the following C file > > ----- cut ----- > // This is first PCCOMP Program tested on MicroFpga! > // Target was S3-200 with KCPSM3_256S MF-Core > > #include "..\inc\padmap.h" > #include "..\inc\board.h" > #include "..\lib\pinapi.h" > > unsigned int i; > > // Delay > void ledelay() { for (i=0;i<65000;i++) {} } > > void main() > { > // blink a LED forever ! > while (1) { > SetPin(LED1, 0); ledelay(); > SetPin(LED1, 1); ledelay(); > } > } > ----- cut ----- > > generates a BIT file (without invoking synthesis or fpga implementation > tools) > and there is LED blinking on my desk right this moment :) > > KCSPM3_256S core only supports maximum 256 FPGA I/Os but its still fun > > the evaluation package is ready for download > > http://www.microfpga.com/joomla/index.php?option=com_remository&Itemid=27&func=fileinfo&id=3 > > it includes the MicroFpga bitstreams and compile scripts > devices included: > xc2v1000_fg256 > xc2v250_cs144 > xc2v250_fg256 > xc2v250_fg456 > xc2v40_cs144 > xc2v40_fg256 > xc2v500_fg256 > xc2v80_cs144 > xc2v80_fg256 > xc2vp2_ff672 > xc2vp2_fg256 > xc2vp2_fg456 > xc2vp4_fg256 > xc2vp4_fg456 > xc2vp7_fg456 > xc3s1000_fg320 > xc3s1000_ft256 > xc3s200_ft256 > xc3s200_pq208 > xc3s200_tq144 > xc3s200_vq100 > xc3s400_fg320 > xc3s400_ft256 > xc3s400_pq208 > xc3s400_tq144 > xc3s50_cp132 > xc3s50_pq208 > xc3s50_tq144 > xc3s50_vq100 > xc4vfx12_sf363 > xc4vlx15_sf363 > xc4vlx25_sf363 > > note: MicroFpga is useable on linux too, but PCCOMP and KCPSM3 are only > available for > windows platform - on linux the java based picoblaze assembler should be > used > (we have no scripts or support for that at the moment) > > Antti > PS MicroBlaze based MicroFgpa packages are are also ready but will be > released a little later.
"spartan3wiz" <magnus.wedmark@gmail.com> schrieb im Newsbeitrag 
news:1166710133.913520.220700@n67g2000cwd.googlegroups.com...
> Hi Antti, > > I like what you have done and are trying to do with MicroFPGA. Nice > idea! > > I downloaded your MicroFPGA test-package but I can't get it working > correctly. As I understand the clock used are created by some kind of > internal DDS of something? Can you explain this further? Can this give > problems with differnet circuits? > > I tried out both the build.bat for the assembler-example and the > build.bat for the C-example. Both of them create a download.bit but > when downloading them using Impact no LED is blinking. >
Hi Magnus, thanks a lot for trying - it seems that you made all correct there was however a minor typo in assembly example build script namly project was set to 'blink' and source code was 'leds' as result an empty hex file was created, and that will not do anything. the c example should have compiled out of the box, and assuming the board specific include file was ok, it should have worked. all MicroFpga's start without the need of any external signals eg no clock or reset is required depending on the MicroFpga config there may be options to change the clock later to either different frequency or source. note that there is also no need to worry about "startup clock" setting, the same bitstream will work without changing the clock option from jtag and from cclk based configuration method. S3sk board has LEDs active high, so when the microfpga is loaded all of them should be half-on because of the fpga pullups. if want to troubleshoot uncomment the "clean" to leave all files in place and look that the .mem file is not empty after configuring with download.bit read back the usercode should be a5000001 if that all doesnt help please contact per email, we do provide support Antti http://groups.google.com/group/microfpga
Antti,

Thank you very much for your support while messing around with the
demo-versions of MicroFPGA. Now everything works out fine. In the end
it all was configuration bug in either the Spartan-3 Starter Kit or the
Xilinx ISE package! I still think that Xilinx has a great complete
solution for FPGA-development. All software has bugs... you just have
to find a way to work around them! :-)

PS:
That LED is blinking like hell now! I can hardly get it to stop! :-)

See ya!
Magnus

Antti Lukats wrote:
> "spartan3wiz" <magnus.wedmark@gmail.com> schrieb im Newsbeitrag > news:1166710133.913520.220700@n67g2000cwd.googlegroups.com... > > Hi Antti, > > > > I like what you have done and are trying to do with MicroFPGA. Nice > > idea! > > > > I downloaded your MicroFPGA test-package but I can't get it working > > correctly. As I understand the clock used are created by some kind of > > internal DDS of something? Can you explain this further? Can this give > > problems with differnet circuits? > > > > I tried out both the build.bat for the assembler-example and the > > build.bat for the C-example. Both of them create a download.bit but > > when downloading them using Impact no LED is blinking. > > > Hi Magnus, > > thanks a lot for trying - it seems that you made all correct > there was however a minor typo in assembly example build script > namly project was set to 'blink' and source code was 'leds' as > result an empty hex file was created, and that will not do anything. > > the c example should have compiled out of the box, and assuming the > board specific include file was ok, it should have worked. > > all MicroFpga's start without the need of any external signals > eg no clock or reset is required depending on the MicroFpga > config there may be options to change the clock later to either > different frequency or source. > > note that there is also no need to worry about "startup clock" > setting, the same bitstream will work without changing the clock > option from jtag and from cclk based configuration method. > > S3sk board has LEDs active high, so when the microfpga > is loaded all of them should be half-on because of the fpga > pullups. > > if want to troubleshoot uncomment the "clean" to leave all > files in place and look that the .mem file is not empty > > after configuring with download.bit read back the usercode > should be a5000001 > > if that all doesnt help please contact per email, we do > provide support > > Antti > http://groups.google.com/group/microfpga
"Antti Lukats" <antti@openchip.org> wrote in message 
news:em9gsm$hg8$1@online.de...
> PicoBlaze C compiler has been available for some time already, > but until yesterday I never tried it. > But today when I type: > >>start build.bat > > then the following C file
Will this work with 7.1 or 7.2 ? or only 8.1 or 8.2 ?