0

I had written a Verilog code given below for simulation purpose.It is working properly during simulation.

 module read_1(clk,reset);
 input clk,reset;
 reg [0:23]dataout;
 reg htpv;
 reg [0:23]e_data;
 reg[1:24]data_out;
 reg [25:0]cpv,cpv_round,e_av;
 reg [0:23]data[0:0]; 
 parameter threshold =8388608;
 integer i,f1;
 always @(negedge reset) 
  begin
   i=0;
   $readmemb("ppm_data.txt",data); 
   dataout=data[0];
   e_data=24'b0;
  end
always @(negedge clk)
  begin
   f1=$fopen("xxxx.txt","a");
   if(i==0)
   begin
   data_out=dataout[(i*24)+:24];
   e_av=(e_data[0:23])>>4;
   e_data=e_data<<24;
   cpv=data_out+e_av;
   cpv_round=(cpv<threshold)?0:16777215;
   htpv=(cpv_round==0)?1:0;
   e_data[0:23]=cpv-cpv_round;
   $fwrite(f1,"%b",htpv);
   i=i+1;
end
 $fclose(f1);
 end
endmodule

Now I am synthesizing above code using Lattice Diamond, I am getting errors at 'Map Design' step. Errors are given below:-

ERROR - map: Design is empty.
ERROR - map: Errors found in users design.  Output files not written.

Why I am getting these errors and how I can resolve them.

Paebbels
  • 15,573
  • 13
  • 70
  • 139
Saad Rafey
  • 65
  • 2
  • 9

1 Answers1

2

The synthesiser is clever, it removes any logic which cannot influence an output.

You have no outputs, only regs - so all your logic gets optimised away and the design is seen as empty.

Note that $fopen and $fwrite are not synthesisable, so don't count as "outputs"

Martin Thompson
  • 16,395
  • 1
  • 38
  • 56
  • Thanks for your help. I have write 'reg htpv' value in the code into a text file. What should I do at synthesis level to do so? – Saad Rafey Feb 06 '13 at 13:44
  • 1
    You can't synthesise file access. You can only make output ports go high and low. With sufficient extra code, you could make them go high and low in a fashion which wrote data to a hard disk connected to the FPGA. But that's quite a lot of work! – Martin Thompson Feb 06 '13 at 14:20
  • Can you please elaborate your answer and please send me a link in this regard – Saad Rafey Feb 06 '13 at 14:47