Pre-synthesis and post-synthesis Simulation not matched!

OP #3555764
Rate this post
useful
not useful
Hello,

In verilog code, I am doing the pre-synthesis simulation correctly for 
the attached attachment "text.txt" but when I am doing the synthesis and 
then checking the simulation result then it is not as per the 
pre-synthesis  simulation result.

For the reference I am attaching .v file with test bench and the 
snapshot of pre-synthesis and post-synthesis simulation.

Please give me the solution of this.
Attached files:
Guest #3555884
Rate this post
useful
not useful
No $readmemb is not synthesizable. Some synthesizer (i.e. Synplfy Pro) 
allows it usage to read memory initial value from a file during 
synthesis.

Also your initial statement contains 2 more statements which don't fall 
under this exception.
Guest #3555960
Rate this post
useful
not useful
Get rid of the undefineds.

Example from Synplify Pro guide for assigning initial values.
1
module top(a, b, c, clk); 
2
input clk; 
3
input [3:0]a, b; 
4
output [3:0]c; 
5
reg [3:0]c =3'b1100; 
6

7
always@(posedge clk) 
8
 begin 
9
  c<= a & b; 
10
 end 
11
endmodule
Guest #3556034
Rate this post
useful
not useful
This
1
output reg [9:0] c1 =0;
for example isn't the exact same syntax as the Synplify sample, which 
would be.
1
output [9:0] c1;
2
....
3
reg [9:0] c1 =0;

(IMO should your version work too, but i have not testet it=

In your trace it looks like it didn't work at all.

1) Are your sure that you have rerun the synthesiser?
2) What is your synthesyser and version.
3) What dose the your synthesysers guide say about assigning initial 
values?
Guest #3556061
Rate this post
useful
not useful
Nisarg Shah wrote:
> yes i have rerun the synthesizer..
> version is symplify pro E-2010.09A-1
> initialization can be valid both, what ever you say as well as readmemb.

But not this:
1
    $readmemb("init.dat", marray);
2
    b = marray[0];

In your traces you can see that initialization does not work at all. But 
the reason may be your simulator (and not the synthesiser).

On Lattice FPGAs i would probably need to instantiate the GSR component 
in the test bench to simulate the correct behaviour.

Also you need to make sure your FPGA (which one) support initial values 
on registers during configuration.

If initial values are not possible, you need to add a reset to your 
deisgn.
Guest #3556080
Rate this post
useful
not useful
Nisarg Shah wrote:
> if I remove "c1=c1+1" line from the code then the output is as in
> attached file. infact c1 variable I have attached to check that
> initialization is done or not. and it does..but then process is not
> done..

No, without c1=c1+1 c1 is a constant value, and optimised as such by the 
synthesizer. in other words it is post synthssis no longer a register.
Guest #3556102
Rate this post
useful
not useful
Nisarg Shah wrote:
> ok..so this is optimised value shown for c1 as it is constant, isn't
> it??

Yes.

Check your FPGA (which one would these be?) data sheet how registers get 
their initial values.

If this does not help, you need to add a reset in the standard verilog 
way

{code]
always @(posedge clock)
begin
 if( reset )
  c1 <= 0;
 else
  c1 <= c1 + 1
end
[/code]

or asynchron (DANGER)
{code]
always @(posedge clock or posedge reset)
begin
 if( reset )
  c1 <= 0;
 else
  c1 <= c1 + 1
end
[/code]

But first check if and how your fpga supports initial values, which 
would the preferred way (unless you need a reset for other reasons)
Guest #3556140
Rate this post
useful
not useful
Nisarg Shah wrote:
> I am using ACTEL (Microsemi)'s 54SXA family's A54SX32A FPGA..So can you
> say that whether it supports initial value or not as I have referred the
> datasheet but couldn't find it out..

Can't find it either, sorry.

Ask the Microsemi support or give up and add a reset to your design.

Maybe the HDL-Analysist from Synplify Pro can give you a hint 
(technology view). Use a init value other than 0 on c1 to see if you can 
find it in the synthesys result.
Guest #3558262
Rate this post
useful
not useful
Nisarg Shah wrote:
> when I used initial value of c1 = 2 and not doing any operation on it,
> it shows that initial value but if I do any operation on it, then it
> shows xxxx value..

That shows the Synthesiser supports initial values but the hardware 
dosn't.
You need to add a reset.
(There should be a warning, see Ottmar posting)

Reply

Please log in before posting.

or

Log in with Google account

Registration is free and takes only a minute.

Register now