I am trying to convert the following line of code to system C, any suggestion or clue would be helpful (trying to find exact translation)
l_lcm_num = (buff_id>>8)&2'h3;
verilog bit [DWIDTH-1:0] fdata[longint][$];
verilog void'($ungetc(c,fp));
I am trying to convert the following line of code to system C, any suggestion or clue would be helpful (trying to find exact translation)
l_lcm_num = (buff_id>>8)&2'h3;
verilog bit [DWIDTH-1:0] fdata[longint][$];
verilog void'($ungetc(c,fp));
In reply to Rogers:
These constructs need to be translated to C++; there is nothing directly in SystemC that would help you.
In reply to dave_59:
And for reporting messages can you please inform me how can we translate for below…? basically I am trying to find the right format to translate them
`uvm_error(get_type_name(), $psprintf("LCM Read Addr x=%0d y=%0d num=%0d greater than size=%0d",x,y,num,sbuff_size));
verilog $write("%d:", y);
verilog `uvm_info(get_type_name(), $psprintf("data[%0x] = 0x%20x",y*h_pitch((x+i)%h_pitch),data[y*h_pitch+((x+i)%h_pitch)]), UVM_HIGH);
verilog $fdisplay(fp, "%08x: %80x %80x %80x %80x", i, data[i*4+3], data[i*4+2], data[i*4+1], data[i*4]);
and this expression
data[y*h_pitch+((x+i)%h_pitch)] = wdata[(QWWIDTH-1)+QWWIDTH*i -: QWWIDTH];
In reply to Rogers:
`uvm_info/error macro functionary was directly copied from SystemC’s SC_REPORT_INFO/ERROR macros. The first argument is a string ID used to control filtering and actions associated with a particular set of messages. How you convert that depends on how you need to control these messages.
You will need to learn C++ string formatting and file I/O capabilities for converting $psprintf, $write, and $fdisplay. This might also depend on the version of C++ you are using as C++ is always making enhancements here.
Look for the range() method in SystemC to convert the -: index part select.
In reply to dave_59:
I tried to find some examples but could not find any which could help me to translate, how would you have done this from your perspective?
In reply to dave_59:
Ok i manged to solve -: using range operator as follows
long long int temp_idx = (QWWIDTH-1)+QWWIDTH*i ;
data[y*h_pitch+((x+i)%h_pitch)]=wdata.range(temp_idx,temp_idx - (QWWIDTH-1));
But the display statements still I am trying to find the solution …