Jump to content


  • Content Count

  • Joined

  • Last visited

About samng

  • Rank

Recent Profile Visitors

303 profile views
  1. samng


    Hi, Can someone show me how to use sc_fxnum_observer class to watch for saturation, roll over etc in objects like sc_fixed? Thanks, Sam
  2. Hi, I am interested in wrapping a C model with SystemC wrapper to mimic a future RTL design. Is it possible to create a port that can connect directly to a SystemVerilog Interface? For Example: SystemC: struct foo{ bool valid; sc_uint<8> data; }; SC_MODULE (xyz) { sc_inout<foo> port1; ... }; SystemVerilog: interface abc () logic valid; logic [7:0] data; endinterface abc abc_i(); xyz ( .port1(abc_i); .... ); Would this work? Thanks, Sam
  3. Hi, Sorry if this has been asked before. I have problem to get sc_module to compile with 2 tlm_blocking_put_if's but with different template types. I have the sc_module inherit tlm_blocking_put_if's like this: class Abc: sc_module, tlm_blocking_put_if<X>, tlm_blocking_put_if<Y> { ...... sc_export<tlm_blocking_put_if<X> > port1; sc_export<tlm_blocking_put_if<Y> > port2; ..... virtual void put(const X &t) { ....} virtual void put(const Y &t) { ....} ..... } Do you see anything wrong? Do I need to use tlm_tag? Thanks, Sam
  4. Thank you, Philipp. Can simple_initiator/target_socket work with non-GP payload?
  5. This is possible, right? I add a target socket as a member to a SC module but not passing generic payload: tlm_target_socket<my_item> inp_sock; But I get the following error: "model.h", line 34: error: type name is not allowed tlm_target_socket<my_item> inp_sock; Do I need to derive 'my_item' from some base class? Thanks, Sam
  6. Alan, thanks for the reply. I think uvmc_tlm is for TLM2 and uvmc_tlm1 is used for TLM1 connection. Is that right? I think tlm_analysis_port is a TLM2 feature, right? Thanks, Sam
  7. Hi, I am trying to connect uvm_analysis_export (SV) and tlm_aanalysis_port (SC) using UVMC like the following: uvm_analysis_export #(obs_xact#(WL,DEP)) sc_export; uvmc_tlm#(obs_xact#(WL,DEP))::connect(sc_export,"fft_ap"); but I got the follow error message: Incompatible complex type usage in task or function call. The following expression is incompatible with the formal parameter of the function. The type of the actual is 'class uvm_pkg::uvm_analysis_export#(class test_pkg::obs_xact#(12,512))', while the type of the formal is 'class uvm_pkg::uvm_port_base#(class uvm_pkg::uvm_tlm_if#(class test_pkg::obs_xact#(12,512),enum uvm_pkg::uvm_tlm_phase_e))'. Expression: this.sc_export Source info: uvmc_tlm#(test_pkg::obs_xact#(12,512),uvm_pkg::uvm_tlm_phase_e,uvmc_pkg::uvmc_default_converter#(uvm_pkg::uvm_object))::connect(this.sc_export, "fft_ap", null ... Isn't uvm_analysis_export is extended from uvm_port_base#(uvm_tlm_if#())? Thanks Sam
  8. Hi sc_fixed type looks ahead to the type of the destination variable to pick the right action for quatisation and overflow handling: sc_fixed<6,6> a = 13; sc_fixed<5,5,SC_RND> b = a>>1; a become 7. But using sc_fixed in a template class like: template <class T, int N> class Vector { T m_array[N]; Vector operator>> (const unisgned int m) const { Vector tmp; for (int i=0; i<N; i++) tmp.m_array = m_array>>m; } }; ..... Vector <sc_fixed<6,6>,1 > a; Vector <sc_fixed<5,5,SC_RND>,1 > b = a >> 1; a[0] is now 6 not 7, because the return type of operator >> is still Vector<sc_fixed<6,6>,1 >. Is there anyway to write the template class/operator that can see the type of b so that sc_fixed rounding behaviour can preserved? Thanks Sam
  9. samng

    sc_fixed_fast speed

    Anyone has experience with the simulation speed of sc_fixed_fast. Done some benchmarking against int and double, sc_fixed_fast is x10 slower. Is this your experience too? Or there are some other factors that affects it speed. Thanks,
  10. Hi, We have been experimenting with wrapping SystemC sim with mexFunction so that it can be called within Matlab. What we find is that repeat calling of the mexFunction causes memory leak as if something was not cleaned up even each SystemC object is meticulaously deleted. Does anyone has experience with calling SystemC from Matlab? Was the memory leak issue encountered? Is there a solution? Thanks, Sam
  11. Thank you, Alan. Is it possible not to compile in the kernel at all by simply including the data types .h files instead of systemc.h? Sam
  12. Is it possible to use only systemc data types without including the simulation kernel? Thanks Sam
  13. samng

    sc_fxcast_switch in class

    Alan, I did define SC_INCLUDE_FX and sc_fixed type is working fine. Dakupoto, The context switch code if put in functions/methods works fine. It seems that it just don't like it in class declaration. Sam
  14. I am trying to implement float and fixed and point computation using the same code using sc_fixed<> and type casting sc_fxcast_switch(). For this, I created a class template and added the type casting code: template <sc_switch FIXPT> class abc { sc_fxcast_switch fxc(FIXPT); sc_fxcast_context fxc_context(fxc); // members sc_fixed<....> a, b, c; ..... } However, the compiler does not seem to like having the type casting code in class declaration, error in VS2010: error C2061: syntax error : identifier 'fxc' Can sc_fxcast_context/switch be members of a class? If not, how do you control the cast switch sc_fixed<> members? Thanks, Sam
  15. samng

    sc_int vs sc_fixed behaviour

    Hi Ralph, Thank you for the explanation. Any idea what is the intermediate type? Some kind of floating point type? Thanks, Sam