%* format specifier

A

Amal

Guest
I cannot seem to find the Verilog 2001, or SystemVerilog equivalent to
%* format specifier in C/C++! Example found below:

$sformat( str, "[%-*s] : %5d", name_max_length, name, value );

Is there a way to achieve this in SystemVerilog somehow?
-- Amal
 
On Aug 19, 4:32 pm, Amal <akhailt...@gmail.com> wrote:
I cannot seem to find the Verilog 2001, or SystemVerilog equivalent to
%* format specifier in C/C++!  Example found below:

  $sformat( str, "[%-*s] : %5d", name_max_length, name, value );

Is there a way to achieve this in SystemVerilog somehow?
-- Amal
Anyone has any ideas about this? Or should this be implemented as a
function?
-- Amal
 
On Aug 19, 4:32 pm, Amal <akhailt...@gmail.com> wrote:
I cannot seem to find the Verilog 2001, or SystemVerilog equivalent to
%* format specifier in C/C++!  Example found below:

  $sformat( str, "[%-*s] : %5d", name_max_length, name, value );

Is there a way to achieve this in SystemVerilog somehow?
There is no equivalent to the %* format specifier in Verilog or
SystemVerilog.

The best suggestion I can come up with is to write your own code to
extract name_max_length characters (or fewer, if there are fewer) out
of name into a separate string variable, and print that instead.
 

Welcome to EDABoard.com

Sponsor

Back
Top