my code looks as below
reg [7:0] c[1:1000];
@(posedge clk)
begin
g=fopen(aa.txt,"w");
for(i=0;i<1000;i=i+1)
begin
$fdisplay(g,"%b",c[i]); end
$fclose(g);
but this code is not synthesizable.i neeed a synthesizable code.
I am using a vertex 6 kit
To accomplish this task (save the contents of a 1000 byte array to a file in some storage media) you only choice is to instantiate some kind of processor (like a MicroBlaze for example) in your design, and interface it to whatever media your FPGA board has (SD, Compact Flash, SATA, IDE, etc), and your 1000 byte array. Then, search for a C library to handle some filesystem like FAT, and write a program that iterates through the 1000 byte array, reading it and using the C library to create a file, store the bytes read from the array and finally, close the file.
It's possible, but not just with the Verilog code you posted. You need to build an entire SoC in your FPGA to deal with it.
Another possibility, much less resource demanding, is to use the built-in devices in your FPGA board to send the 1000 byte array through a serial port or USB, receive it in your PC and save to disk from there.
If you lack communication devices in your board, you can even build a FSK encoder, and transmit the array contents as series of tones, like old modems or even old 80's computers did. Capture the data in your PC using your sound card and some software to decode the audio signal. For this, the only resource you need is a pin configured as output, from your FPGA.
Unfortunately, you are operating at much to high a level for synthesisable code. While it is theoretically feasible for the tools to see your $fwrite
, and know enough about the board you are using to know how to get to a hard disk connected to it, that's not what happens in practise.
In the beginning, chips were so small that hanging a hard disk off them was inconceivable. Now that it is conceivable (you can hang a SATA hard disk directly off an FPGA for example), you would have to give the synthesiser so much information about your board (and indeed system, as it may be plugged into a PC and need to access the hard disk over PCIe) that it is still beyond what is sensible.
Sorry, it just isn't possible.