AnsweredAssumed Answered

Stack Underflow in Simulator

Question asked by petrveprek on Jul 28, 2016
Latest reply on Aug 5, 2016 by Kader.M



I have a C++ project for SC589 where one of the mains runs on SHARC+ core in word-addressed big-endian mode (i.e. SHARC mode).  The application runs fine on the EZ-KIT HW.  Now, I try to run it under a functional simulator.


First I comment out call to a major subroutine, the application is thus reduced to mostly printing some messages to stdout.  When simulated, this generates the expected output, both application as well as simulation end successfully, and the entire simulation takes 200+k cycles.


Then I do call the major subroutine (and within it, skip most of its body).  So my application in this case has the same prologue (consisting of printing to stdout) and the same epilogue (also printing to stdout) as the one above; and additionally, there is more code executed in between the prologue and epilogue.  When I run this under the functional simulator, the simulation ends with "status stack underflow!!!" message.  It takes only <400(!) cycles to reach this point.  Simulation ends with failure code 3.  No output appears on the stdout console.


This happens with release binary as described above.  I get similar result with debug binary.  To simulate, I invoke the simulator (chipfactory) from a command line.


What is strange, is that (in the second scenario) the prologue that works fine in the first case is never simulated and the simulation ends abruptly.  What is going on?