[HH] stubbing out boost::format?

Greg London email at greglondon.com
Wed Apr 1 12:30:17 EDT 2015


I have some c++ code that I've been developing for hardware simulation
over the years.

Very recently I got some cycles to try and port this code as an
executable to the Zedboard, which uses the Xilinx ZYNQ chip, which
has an ARM processor and FPGA fabric. This would give us probably
a couple orders of magnitude in faster executions. And would save
a lot of money in not needing simulation licenses.

The problem is the Xilinx tools do not seem to like Boost::Format.

My c++ code looks like this:

   #include <boost/format.hpp>
   using boost::format;
   using boost::io::group;
   string mystr = (format("%s Timercount=%d") % msg % count ) .str();


Unfortunately, I've used boost::format everywhere.
If it was rare, I'd just manually go through it and
convert it to sprintf() or something.
But its literally used thousands of different places
in my code.

Anyway, I thought maybe there might be a way to roll my own
version of format() so that it just calls sprintf().
Except I never quite understood the percent separators
in format.

I basically need something like this:

    string boost::format(%){
       return sprintf(%);
    }

Worst comes to worse, it's an empty function.
I just want to get something to compile on the FPGA.

It would be nice if the IO could be sent to the
terminal port, which means the stub would have to actually
return something meaningful.  But really, the priority
is just getting the code to do memory accesses and the
IO is helpful but not absolutely required.

Could someone point me to a solution for this?

Thanks,
Greg







More information about the Hardwarehacking mailing list