Author Topic: Quartus ALTFP_SQRT IP not working in simulation  (Read 755 times)

0 Members and 1 Guest are viewing this topic.

Offline rokspyTopic starter

  • Contributor
  • Posts: 24
  • Country: lv
Quartus ALTFP_SQRT IP not working in simulation
« on: April 09, 2023, 06:36:40 pm »
I am trying to use the Quartus ALTFP_SQRT IP in simulation, but the output always results in undefined state. It should take and output single precision floating point number (23 bits for mantissa, 8 for exponent and 1 for sign). Left the latency to the default value of 28 cycles and avoided any optional inputs and outputs. Clock is set to 100MHz. All files, including the generated IP .vhd, compiles without any issues. Tried feeding the input in different ways - just a constant vector, signals from other parts of the design, but output remains undefined anyways. Quartus can also compile it and generate a netlist for it, but have not tried to check in in real life yet, before I can deal with the simulation. What could be the cause for the undefined output?? Am I completely missing something??
EDIT: My personal thought is that it may be something related to the Modelsim libraries and the file describing the IP behavior is not present and it does not know how to simulate it, but I would assume that the compiler would cry about this, and I'm not really sure how to verify this.

FINAL UPDATE:
Got it working.. Initially I assumed that the behavior of the generated IP component is already present in the "altera_mf" library, which was a faulty assumption because when I started digging through the library, could not find the component, which was used in the generated ip .vhd file. What I failed to notice initially was that there were additional simulation files generated, that had to be compiled and added to the testbench. After switching to these files, dealing with some other minor compilation nonsense, simulation worked, and provided valid results (square root of 4 is indeed 2)
Thanks for the suggestions in advance!
« Last Edit: April 09, 2023, 11:20:15 pm by rokspy »
 

Offline ejeffrey

  • Super Contributor
  • ***
  • Posts: 3889
  • Country: us
Re: Quartus ALTFP_SQRT IP not working in simulation
« Reply #1 on: April 09, 2023, 07:24:18 pm »
Are you resetting it?

Some simple IPs like this will work without reset when synthesized because the pipeline will clear deterministically but in simulation will stay X forever due to x propagation.
 

Offline rokspyTopic starter

  • Contributor
  • Posts: 24
  • Country: lv
Re: Quartus ALTFP_SQRT IP not working in simulation
« Reply #2 on: April 09, 2023, 07:35:18 pm »
Initially there was no reset in the generated IP. I added it now and tried resetting it as well, but with no luck, the result is still 'UUU...'.. A good try though
 

Offline Daixiwen

  • Frequent Contributor
  • **
  • Posts: 367
  • Country: no
Re: Quartus ALTFP_SQRT IP not working in simulation
« Reply #3 on: April 17, 2023, 09:33:32 am »
Got it working.. Initially I assumed that the behavior of the generated IP component is already present in the "altera_mf" library, which was a faulty assumption because when I started digging through the library, could not find the component, which was used in the generated ip .vhd file. What I failed to notice initially was that there were additional simulation files generated, that had to be compiled and added to the testbench. After switching to these files, dealing with some other minor compilation nonsense, simulation worked, and provided valid results (square root of 4 is indeed 2)!
Modelsim is very annoying with that. If it doesn't find an entity that you instantiate in your code, it just says "instance xxx is not bound" as a warning, it's not even an error. When I get some strange behavior the first time I run a testbench the first thing I do is search the log for "not bound".
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf