Picobalze in the FPGA

Hi people,

i am a new person in the FPGA field. I have just made something with IC from Xilinx( just make a FPGA'sboard at home). I know it worked well when i check it with some program.I started to learn to control it.It is said that There is a processor inside FPGA called Picoblaze. I try to program for it, but i have no following thing.

I can program with the C software, then use a C compiler to compile it then load into FPGA. I do not know if this process is Ok or not. i also want to know when programming in C, Should i use the standard C language or Use the Picoblaze languge but written in C.

does everyone make me clear somethings mentioned above. I would like clarify why i can asked the stupid questions. I did them because i am only a hardware designer.

I am looking forward hearing from everbody soon,

Himlam8484

Reply to
Himlam8484
Loading thread data ...

Programming Picoblaze in C might not be the best route for now (there is no good C compiler available). However, programming the picoblaze using its assembly language is quite straightforward.

--
Reply to nico@nctdevpuntnl (punt=.)
Bedrijven en winkels vindt U op www.adresboekje.nl
Reply to
Nico Coesel

In article , snipped-for-privacy@puntnl.niks (Nico Coesel) writes: |> Programming Picoblaze in C might not be the best route for now (there |> is no good C compiler available). However, programming the picoblaze |> using its assembly language is quite straightforward.

While we are at it, is there any kcpsm-compatible commandline assembler for Linux, especially for PB V3? I've found one in an KDE IDE, but that doesn't work with makefiles. It shouldn't be too hard to write one in the lunch break, but if it already exists...

I've tried to run kcpsm3.exe with wine, but that didn't work for some reason...

--
         Georg Acher, acher@in.tum.de
         http://www.lrr.in.tum.de/~acher
         "Oh no, not again !" The bowl of petunias
Reply to
Georg Acher

Pacoblaze (google it) comes with an assembler written in C++ (and source). ^

--
Ben Jackson AD7GD

http://www.ben.com/
Reply to
Ben Jackson

I found a C compiler for picoblaze, it have a manual and some examples. But i try to compile it following the direction in the manual, it was not work. It always noticed "open failes" . i also write a simple C program to test but nothing can make it run.

I also try to write a email to author, but he did not answer yet. Can anyone use it and get good results?

Himlam

Reply to
Himlam8484

Himlam8484 schrieb:

Hi Himlam, let me set some points straight.

1.) There "is" no PicoBlaze processor into any FPGA unless you have synthesized the PicoBlaze sources (and the rest of your design) and downloaded the bitstream into the FPGA.

2.) As far as I know there is only one C-Compiler available for the PicoBlaze: PCCOMP from Francesco Poderico. This one supports only Picoblaze for Spartan3 and Virtex II FPGAs.

So, which kind of FPGA are u using on your board?

Which "open fails"? The open for reading your source code or have you used an open() function in your source? In the first case you probably made some mistake while invoking the compiler. In the second case you just forgot that you are writing code for a simple microcontroller. There is nothing to open.

Have a look at the manual. The allowed statements are as reduced as the PicoBlaze itself is. So take good care what you are programming. Not everything is allowed or meaningful when using PCCOMP.

About the other questions: You can run the KCPSM.EXE under linux by using some DOS emulation program. I'm running it under wine :

wine kcpsm.exe

I'm not sure about the KCPSM3.EXE. Either your WINE is not up to date, or maybe you forgot to put the ROM_form.* templates into the correct path?

Have a nice synthesis Eilert

Reply to
backhus

Hi Eilert,

Thank you very much for your idea. i am using a IC XC3S400. I know it get a Picoblaze inside. First, i only test program PCCOOMP to sure it runs well. "open failed" means PCCOMP can not open file( for example, I downloaded a file from the place i loaded PCCOMP soft). I open these files with Borland C, and they are Ok. But when i compiled in PCCOMP , it always failed.

I have no occassion to get a code to load into Picobalze.

By the way, i think you get much knowledge about FPGA, can you make me clear somethings? i would like to program for Picoblaze In C, i have to include "Spartan3.h" to be able to use Picoblaze languege in C, wouldn't I? Please tell me with my stupid questions.

have a nice day!

Him Lam

Reply to
Himlam8484

Himlam8484 schrieb:

Hi Him, Today I have tested PCCOMP 1.8.4 with two of its examples (sqrt and fibonacci)

Two things have to be taken care of: the header files have either to be placed in a subdirectory called lib, or the includes hav to be changed to e.g. #include "spartan3.h" if the header files are in the same directory as the source file. whatever you prefer.

i used the following commandline:

pccomp -c -s example_sqrt.c

pccomp -c -s ex_fibnacci_s3.c

there was a little error in the fibonnacci source: on line 69 you have to add a missing #endif but then it compiles without errors.

after all mi directory looked like this:

14.02.2007 08:02 . 14.02.2007 08:02 .. 14.02.2007 07:40 941 example_sqrt.c 14.02.2007 07:41 5.567 example_sqrt.fra 14.02.2007 07:41 5.574 example_sqrt.pod 14.02.2007 07:41 5.566 example_sqrt.psm 14.02.2007 08:02 2.105 ex_fibnacci_s3.c 14.02.2007 08:02 5.532 ex_fibnacci_s3.fra 14.02.2007 08:02 5.563 ex_fibnacci_s3.pod 14.02.2007 08:02 5.531 ex_fibnacci_s3.psm 03.12.2006 13:45 356.287 pccomp.exe 03.07.2005 14:41 211.332 pccomp_manual.pdf 28.01.2005 09:23 771 spartan3.h 04.02.2005 15:00 768 sqrt.h

The *.psm files have to be assembled with the kcpsm3.exe In order to do so you have to rename or copy the *.psm files to dos-like

8.3 filenames. e.g. sqrt.psm and fibo.psm.

Now kcpsm3 can assemble these sources, and your directory may look like this:

14.02.2007 08:16 148 CONSTANT.TXT 14.02.2007 07:40 941 example_sqrt.c 14.02.2007 07:41 5.567 example_sqrt.fra 14.02.2007 07:41 5.574 example_sqrt.pod 14.02.2007 07:41 5.566 example_sqrt.psm 14.02.2007 08:02 2.105 ex_fibnacci_s3.c 14.02.2007 07:41 2.097 ex_fibnacci_s3.c~ 14.02.2007 08:02 5.532 ex_fibnacci_s3.fra 14.02.2007 08:02 5.563 ex_fibnacci_s3.pod 14.02.2007 08:02 5.531 ex_fibnacci_s3.psm 14.02.2007 08:16 8.085 FIBO.COE 14.02.2007 08:16 5.703 FIBO.DEC 14.02.2007 08:16 8.876 FIBO.FMT 14.02.2007 08:16 7.168 FIBO.HEX 14.02.2007 08:16 13.806 FIBO.LOG 14.02.2007 08:16 4.309 FIBO.M 14.02.2007 08:16 7.179 FIBO.MEM 14.02.2007 08:02 5.531 fibo.psm 14.02.2007 08:16 23.300 FIBO.V 14.02.2007 08:16 19.273 FIBO.VHD 05.07.2005 08:33 90.308 KCPSM3.EXE 14.02.2007 08:16 228 LABELS.TXT 14.02.2007 08:16 25.517 PASS1.DAT 14.02.2007 08:16 25.517 PASS2.DAT 14.02.2007 08:16 30.702 PASS3.DAT 14.02.2007 08:16 39.894 PASS4.DAT 14.02.2007 08:16 53.003 PASS5.DAT 03.12.2006 13:45 356.287 pccomp.exe 03.07.2005 14:41 211.332 pccomp_manual.pdf 25.01.2002 15:17 857 ROM_form.coe 04.07.2005 17:05 15.275 ROM_form.v 05.07.2005 08:39 12.748 ROM_form.vhd 28.01.2005 09:23 771 spartan3.h 14.02.2007 08:14 8.085 SQRT.COE 14.02.2007 08:14 5.998 SQRT.DEC 14.02.2007 08:14 10.025 SQRT.FMT 04.02.2005 15:00 768 sqrt.h 14.02.2007 08:14 7.168 SQRT.HEX 14.02.2007 08:14 15.318 SQRT.LOG 14.02.2007 08:14 4.604 SQRT.M 14.02.2007 08:14 7.179 SQRT.MEM 14.02.2007 07:41 5.566 sqrt.psm 14.02.2007 08:14 23.300 SQRT.V 14.02.2007 08:14 19.273 SQRT.VHD

The files SQRT.VHD/V/MEM etc. and FIBO.VHD/V/MEM etc. are the sources for your Picoblaze-ROM. Depending on the flow you use you have to include the right one to your ISE-Project.

Now you can implement your design and download the bitfile to your FPGA.

I don't know which source you have tried. The above examples work just fine.

Have a nice synthesis Eilert

Reply to
backhus

Hi,

First, thank you very much for your idea. I got some interestings thing from you. I have just come back my work from long holiday in my country. I compile 2 example file. Example_Sqrt is ok, But i have problems with fibonacci file. when i compile file fibo.psm i have the following screen:

01E LOAD ZH, 00 01F SUB YL, 01 020 STORE ZL, (YL) 021 FETCH ZL, _N 022 SUB YL, 01 023 STORE ZL, (YL) 024 CALL _outchar 025 ADD YL, 02 026 ; Fibonacci_result=Fibonacci(N); // calculate fibonacci of N 026 FETCH ZL, _N 027 SUB YL, 01 028 STORE ZL, (YL) 029 CALL _Fibonacci

ERROR - Address is not 3-digits: _Fibonacci

Provide a correct absolute address in range 000 to 3FF or a matching line label. Note that labels are case sensitive.

Please correct and try again.

KCPSM3 complete.

Can you show me clearly again!

I know, my questions may be stupid. But i think" wanting to know must to ask"

please help me,

Him Lam

Reply to
Himlam8484

Himlam8484 schrieb:

Hi Him, the fibo.psm assembles without errors on my machine. maybe you have put the #endif in the wrong line? Here is the version of fibonacci.c I used:

//////////////////////////////////////////////////////////////// // KCPSM3 ONLY // HOW EASY IS TO BE AN FPGA DESIGNER !!!

#define use_scr_ram

//////////////////////////////////////// // spartan3.h is a library that must be used if yoy want to use scracthpad memory // #ifdef use_scr_ram #include "spartan3.h" #endif // //

//#define ONE #define TWO //#define THREE

// Fibonacci example // the sequence of Fibonacci is: // //1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 etc. char N; char Fibonacci_result; char i,ii,Last; char Next,Answer;

char Fibonacci(char N);

void main(){ // char Next,Answer; #ifdef use_scr_ram N = inchar(0); // read N from IO addr.0 outchar(0xaa,N); // test Fibonacci_result=Fibonacci(N); // calculate fibonacci of N outchar(0,Fibonacci_result); // write Fibonacci(N) at address 0

// the next loop calculta Fib(2) and write in 2, then calculate Fib(3) and write in 3, etc. for (ii=2; ii

Reply to
backhus

Hi Eilert,

i have just compiled it successfully, Thank you very much for your supporting.

Reply to
Himlam8484

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.