Jump to content

All Activity

This stream auto-updates     

  1. Today
  2. You create 5 signals carrying a TraceVector. Doing so the default constructor is used which does reserve space for elements but has a size of 0... I can't tell where the assertion comes from. For those cases a debugger is pretty helpfull B-)
  3. I am debugging a problem with my custom datatype for sc_trace. I use my datatype for sc_signal, which is inside a sc_vector. Then I trace each signal inside the sc_vector. To narrow down my problem I removed all unnecessary parts for debugging. I still get the error, even though I'm not tracing a single signal. My MWE: main.cpp: // SystemC_FirstTest.cpp : Defines the entry point for the console application. // #pragma once //#define WIN32_LEAN_AND_MEAN //needed for tcp (winsock, ws2) #include <systemc.h> #include "globals.h" SC_MODULE(mA) { sc_inout<int> SC_NAMED(A); void stim() { wait(1, SC_SEC); A.write(0); wait(1, SC_SEC); A.write(1); }; SC_CTOR(mA) { SC_THREAD(stim); } }; SC_MODULE(mB) { sc_inout<int> SC_NAMED(A); void stim() { wait(0.8, SC_SEC); A.write(2); wait(1.1, SC_SEC); A.write(3); }; SC_CTOR(mB) { SC_THREAD(stim); } }; int sc_main(int argc, char** argv) { sc_vector< sc_signal<int, SC_MANY_WRITERS > > stub_vec("top_stub", 5); sc_vector< sc_signal<TraceVector, SC_MANY_WRITERS > > sim_vec("top_sim_", 5); mA SC_NAMED(modA); mB SC_NAMED(modB); modA.A(stub_vec[0]); modB.A(stub_vec[0]); sc_trace_file *tf = sc_create_vcd_trace_file("traces"); if (!tf) { cout << "Empty TraceFile could not be generated." << endl; } //sc_trace(tf, &(stub_vec[0]), "yolo"); //sc_signal<int, SC_MANY_WRITERS > testSig; //sc_trace(tf, &testSig, "yolo_more"); //for (int i = 0; i < 5; i++) { //sc_trace(tf, &(sim_vec[i]), sim_vec[i].name() ); //} // start simulation sc_start(); sc_close_vcd_trace_file(tf); return 0; } globals.h: #pragma once #include <systemc.h> #include <vector> // Vector that is traceable by sc_trace class TraceVector { private: std::vector<int> vec; public: // Methods for accessing list const std::vector<int>& read() const { return vec; } void write(std::vector<int> var) { if (var.size() != 4) { throw std::invalid_argument("Argument is not size 4!"); } this->vec.assign(var.begin(), var.end()); } // CTOR TraceVector() { vec.reserve(4); } // CTOR for init values TraceVector(std::vector<int> var) { if (var.size() != 4) { throw std::invalid_argument("Argument is not size 4!"); } vec = var; } // Required by sc_signal<> and sc_fifo<> TraceVector operator= (const TraceVector& var) { write(var.read()); return *this; } // Required by sc_signal<> bool operator== (const TraceVector& var) const { auto temp = var.read(); // size check if (temp.size() != vec.size()) { return false; } // element wise comparison bool equal = std::equal(vec.begin(), vec.end(), temp.begin()); return equal; } }; // Required functions by SystemC ostream& operator<< (ostream& os, const TraceVector& var); void sc_trace(sc_trace_file* tf, const TraceVector& var, const std::string& nm); globals.cpp: #include "globals.h" // Required functions by SystemC ostream& operator<< (ostream& os, const TraceVector& var) { os << "{"; for (auto& val : var.read()) { os << val << " "; } os << "}"; return os; } void sc_trace(sc_trace_file* tf, const TraceVector& var, const std::string& nm) { int pos = 0; //static int temp = 0; //sc_core::sc_trace(tf, temp, nm + "_test"); for (auto& val : var.read()) { // use namespace, compiler otherwise chooses wrong function sc_core::sc_trace(tf, val, nm + "." + std::to_string(pos++)); } } Where is the vector subscript error coming from? Why is it even appearing when I'm not tracing a signal with my custom type? When I completely remove tracing, no error appears.
  4. Yesterday
  5. Hello , I am having a closed design which is running using SystemC 2.3.1 , When i updagraded to version 2.3.2 i found an error resulting from multi_socket_bases.h in the b_transport method "Call to b_transport without a registered callback for b_transport" as shown below. multi_socket_bases.h void b_transport(transaction_type& trans,sc_core::sc_time& t){ //check if a callback is registered if (m_b_f && m_b_f->is_valid()) { (*m_b_f)(m_id, trans,t); //do the callback return; } display_error("Call to b_transport without a registered callback for b_transport."); } Although , customer is supposed to be registering callbacks correctly as the register_b_transport function is called , but it looks like the callback pointers are not set due to an extra check as mention below in the end_of_elaboration function in multi_passthrough_socket.h // complete binding only if there has been a real bind bool unbound = (binders.size() == 1 && m_export_callback_created); // no call to get_base_interface has consumed the export - ignore if (unbound) return; void end_of_elaboration(){ //'break' here if the socket was told not to do callback binding if (m_eoe_disabled) return; //get the callback binders and the multi binds of the top of the hierachical bind chain // NOTE: this could be the same socket if there is no hierachical bind std::vector<callback_binder_fw<TYPES>* >& binders=get_hierarch_bind()->get_binders(); std::map<unsigned int, tlm::tlm_bw_transport_if<TYPES>*>& multi_binds=get_hierarch_bind()->get_multi_binds(); // complete binding only if there has been a real bind // THIS IS A NEW CHECK WHICH WAS NOT IN 2.3.1 bool unbound = (binders.size() == 1 && m_export_callback_created); // no call to get_base_interface has consumed the export - ignore if (unbound) return; //// // iterate over all binders for (unsigned int i=0; i<binders.size(); i++) { binders[i]->set_callbacks(m_nb_f, m_b_f, m_dmi_f, m_dbg_f); //set the callbacks for the binder if (multi_binds.find(i)!=multi_binds.end()) //check if this connection is multi-multi //if so remember the interface m_sockets.push_back(multi_binds[i]); else{ //if we are bound to a normal socket //get the calling port and try to cast it into a tlm socket base base_initiator_socket_type* test=dynamic_cast<base_initiator_socket_type*>(binders[i]->get_other_side()); if (!test){display_error("Not bound to tlm_socket.");} m_sockets.push_back(&test->get_base_interface()); //remember the interface } } } When I commented out this extra check , the design worked fine. I would appreciate if you can tell me what could be the reason for this check and what to check ? and if there are any known issues with this extra check ? i can see that there are some fixe 2.3.3 to check the hierarchial binding but it did not work too. Thanks, Samuel
  6. Last week
  7. What attributes are you modeling? Seems to me you would measure throughput and latency, but it might be meaningless if you are not modeling time. What assumptions are you making about the implementation technology? If somebody asked you to measure performance, ask them.
  8. I have systemc code given implementing FIFO. I need to evaluate the performance and plot a graph. What all attributes do I consider using and vary to get graphs?
  9. First observation: sc_main is not a module. I would suggest you put them in a real top module; however, that is likely not the real problem. Second observation: you need to show us more code. WHat you have showns is insufficient to analyze. For example, we have no idea what the port connectivity is nor how it is connected. If you have TLM, then you need to show those aspect. We would need to see at least the contents of pe and cpu for the information you have shown.
  10. I want to instantiate two module with the same implementation in the top module like below: int sc_main(int argc, char* argv[]) { pe *pe = new pe("pe0", "0"); pe *pe1 = new pe("pe1", "1"); sc_start(); } If there is only one PE, everything works as expected. But, I got a run time error, Error: (E120) sc_export instance has no interface: pe1.cpu1.tlm_base_initiator_socket_export_1, while running simulation with 2 PEs. I have checked the interfaces are implemented and bound for all the sockets in the PE module. What can I do to make sure where the problem is? Thanks and appreciate for all suggestions in advance!
  11. Hi all, I got some issue when test memory check (valgrind 3.11.0). ==467== Use of uninitialised value of size 8 ==467== at 0x300B000: ??? (in /lib64/libsystemc-2.3.1.so) ==467== by 0x3000B02: sc_core::wait(…) (in /lib64/libsystemc-2.3.1.so) ==467== by 0x3000C04: sc_core::sc_module::wait(…) (sc_module.h) ==467== by 0x40B0B9A: SAZZ::EndThread() (SAZZ.cpp:813) ==467== by 0x40EB0B1: sc_core::sc_thread_cor_fn (in /lib64/libsystemc-2.3.1.so) ==467== by 0x4139044: ??? (in /lib64/libsystemc-2.3.1.so) ==467== Uninitialized value was created by a stack allocation ==467== at 0x300B000: ??? (in /lib64/libsystemc-2.3.1.so) ==467== Use of uninitialised value of size 8 ==467== at 0x700B000: sc_core::sc_sc_event_expr<sc_core::sc_event_or_list>::~sc_event_expr() (in /mywork/execute.x) ==467== by 0x40BC9A: SAZZ::EndThread() (SAZZ.cpp:813) ==467== by 0x413D0D8: sc_core::sc_thread_cor_fn(void*) (in /lib64/libsystemc-2.3.1.so) ==467== by 0x4130300: ??? (in /lib64/libsystemc-2.3.1.so) ==467== by 0x4136094: ??? (in /lib64/libsystemc-2.3.1.so) ==467== Uninitialized value was created by a stack allocation ==467== at 0x300B000: ??? (in /lib64/libsystemc-2.3.1.so) ==467== Invalid read size 8 ==467== at 0x600B000: sc_cor_qt_yieldhelp (in /lib64/libsystemc-2.3.1.so) ==467== at 0x600BC00: ??? (in /lib64/libsystemc-2.3.1.so) ==467== by 0x6000B02: sc_core::wait(…) (in /lib64/libsystemc-2.3.1.so) ==467== by 0x6000C04: sc_core::sc_module::wait(…) (sc_module.h) ==467== by 0x60BC9A: SAZZ::EndThread() (SAZZ.cpp:813) ==467== by 0x613D0D8: sc_core::sc_thread_cor_fn(void*) (in /lib64/libsystemc-2.3.1.so) ==467== by 0x6130300: ??? (in /lib64/libsystemc-2.3.1.so) ==467== by 0x6136094: ??? (in /lib64/libsystemc-2.3.1.so) ==467== Address 0xE14be48 is 598 bytes inside a block of size 624 alloc'd ==467== at 0x400BD00: operator new[](unsigned long) (vg_replace_malloc.c:422) ==467== by 0x600BA00: sc_core::sc_core_pkg_qt::create(unsigned long, void (*), void*)(in /lib64/libsystemc-2.3.1.so) void SAZZ::EndThread(){ while(1){ ... wait( period, time_resolution, next_event[index] | change_event[index]);//line 813 } } Have you any idea? Thanks for your support
  12. Earlier
  13. Hi all , The m_check_relationship function checks the following :: That the connection is between ports that are hierarchically adjacent (up or down one level max, or are siblings), and check for legal direction, requirer.connect(provider) . In case of a violation we return 0 ( with a warning ) else we return 1 . But we always use a void cast while calling m_check_relationship function . Even if I get a warning I see that the transaction does transfer . Eg :: For put_port( txn ) called from component will invoke the put_imp connected to the port ( with a warning ) . I tried it with uvm 1.1d as well as 1.2 , but I still see a warning with the transaction transfer . Is the function meant for future versions to give an error ?
  14. This is like an OO or C++ question. If you draw out the class diagram including the classes you are interested in and their relationships, that should answer your question. I would suggest using doxygen on your code base to see what it observes.
  15. Dear experts, I'v create a user-defined TLM-2.0 socket which inherit from tlm_target_socket/tlm_initiator_socket. I want to know if there is a way to bind my user-defined TLM-2.0 socket with TLM-2.0 standard socket, like multi_passthrough_target_socket/multi_passthrough_initiator socket?
  16. The SystemC AMS standard defines in section 9.1.2.6 (sca_util::sca_trace) that it can trace objects of type sca_traceable_object. Since all ELN primitives are derived of this type, you can simply trace the ELN component itself, see example below SC_MODULE(eln_circuit) { // node declaration sca_eln::sca_node n1; // ELN node sca_eln::sca_node_ref gnd; // ELN ground // component declaration sca_eln::sca_vsource vin; sca_eln::sca_r r1; // constructor including ELN netlist eln_circuit( sc_core::sc_module_name nm ) : vin("vin", 0.0, 1.23), r1("r1", 1e3) { // Only ELN primitives requires explicit timestep assignment to one element vin.set_timestep(1.0, sc_core::SC_MS); // netlist vin.p(n1); vin.n(gnd); r1.p(n1); r1.n(gnd); } }; int sc_main(int argc, char* argv[]) { eln_circuit cir("eln_circuit"); sca_util::sca_trace_file* tf = sca_util::sca_create_tabular_trace_file("trace.dat"); sca_util::sca_trace(tf, cir.n1, "v_n1"); sca_util::sca_trace(tf, cir.vin, "i_through_vin"); sca_util::sca_trace(tf, cir.r1, "i_through_r1"); sc_core::sc_start(1.0, sc_core::SC_MS); sca_util::sca_close_tabular_trace_file(tf); return 0; }
  17. Hi, According to the SystemC AMS User Guide 2020 (p.g. 92), Can I know how exactly this is done, with examples? Many thanks in advance!
  18. The only normative reference for SystemC is defined by the IEEE Std. 1666-2011, see http://ieeexplore.ieee.org/document/6134619/. The is_reset() was never part any version of the standard, so one could never rely on its presence. You would to check, why the ReChannel library tries to call this function and then find another way to implement this functionality. /Philipp
  19. Create an sc_vector<sc_signal<bool>, 4>, but then you have to assign and deal with four separate signals.
  20. I have referred (https://www.xilinx.com/support/documentation/sw_manuals/xilinx2019_2/ug902-vivado-high-level-synthesis.pdf ) the design guide page no:379 and it says that it can be synthesized... Is there any other tool like vivado hls to synthesize my code? or is there any documents to know things more about the usage guides for sc_fifo to make it synthesizable?
  21. Synthesizability rules are ultimately up to the HLS synthesis vendor, and they are definitely different between vendors. The synthesizable subset standard is simply a guideline of commonly agreed upon constructs that either clearly able to be synthesized (e.g. sc_signal) or not (e.g. new and delete). Every synthesis tool will have some variance. Please refer to your sythesis vendor's reference manual to learn their rules. If that fails, contact their support. Simulation does not guarantee synthesizability.
  22. Hello, I am trying to connect a custom fifo between 2 modules, that works fine in simulation and verification in my linux and also vivado hls but when i try to synthesize it using vivado hls , it give an error as, ERROR: [SYNCHK 200-91] Port 'imp.cons.in.m_if.Val.data' (../final/p.h:200) of function 'center_detector' cannot be set to a FIFO ERROR: [SYNCHK 200-91] as it has both write (../final/x.h:19:17) and read (../final/y.cpp:9:4) operations. Is that synthesizable or not ? sc_port<sc_fifo_out_if<line> >out; // producer module port sc_port<sc_fifo_in_if<line> > in; // consumer module port my read and write operations as out->write(f); in->read(f); I saw this similar topic in https://forums.xilinx.com/t5/High-Level-Synthesis-HLS/SystemC-sc-fifo-and-hierarchy/td-p/741511 , but i couldn't get the answer . please help me to solve this.
  23. Hello guys, I'm new to SystemC and I'm learning now but I'm stuck on a very simple issue that I cannot resolve: I have an output that is a 4-bit bus sc_out<sc_uint<4> > counter_out; // 4 bit vector output of the counter that I trace with sc_trace(wf, counter_out, "count"); This will dump the output on a single coordinate system, showing me the numbers on the bus in hex format. However I want to display all four wires on separate coordinate systems, one for each bit. What is the best way to do this? Regards, L. B.
  24. I have seen several SV-DPI and pthread related posts in this forum and in stackoverflow. However, it seems no post for SV-DPI and co-routine. I guess the reason is there is NO standard library or C language native support for co-routine ( except C++20). Now I'm trying several C based co-routine libraries mentioned in https://en.wikipedia.org/wiki/Coroutine to support python/javascript type of generator in Systemverilog/UVM testbench. Here is how. 1. One SV thread is working as main thread. A SV function will be working as a co-routine and exported to DPI. 2. The SV thread need to create a co-routine by calling co_create through the DPI. the first argument of the co_create would be a wrapper function to the SV exported function. And co_create will use a dynamically allocated array as standalone stack for the co-routine being created. 3. Then SV thread need to resume the co-routine by calling co_resume through the DPI. Here, stack pointer of the CPU will switch to the new stack of the co-routine and entry point is the wrapper function. And finally, the execution will go to the SV exported function and go back to SV side. 4. In the middle of the SV exported function, co_yield will be called. stack pointer will be switched back to the main thread and program counter will be returned to right after the co_resume. Finally, execution will return back to the SV side of the main thread. 5. Above step 3-4 can be repeated many times until the exported function is finished and co-routine can be destroyed. I don't know how much stack space is needed to run SV functions on it. I just allocated 32KB for each co-routine. That's all. This is completely single threaded with user space cooperative multiple tasking. Again, this is to mimic the python/javascript type of generator for test framework development. Is there any risk ?
  25. Hi Chethan, the issue you see comes probably stems from the driver and sequencer being created during the build phase when you start run_test(...). Your hierarchical logfile setting happens before that, so that the driver and sequencer could not know of that setting. To enable the wanted behaviour, you need to move the log setting to a later place in runtime or make the driver and sequencer full members of the environment.
  26. Hi Ralph, thanks for your reply. I also recognized that this function is private, so i did the workaround making this function public. This fast solution is for the moment ok, but not as long term option. I know that is not a good solution, but it is a qick dirty fix. I have an old SystemC Library(ReChannelv2 from 2007) where this call is used and i want to use this library(the library is not compiling yet). For now i have not the resources to refactor the old library to the newer C++(11 or 14) and SystemC(2.3.3) standard. Also it is an external library, so it is hard to get in and understand how the implementation is done in detail. In theory, i only want to use it 😉 This library is i would say something which wrapped extra stuff around the systemc classes to model reconfiguration during runtime. If i check the SystemC version 2.2, there was this function public, so it was allowed to use this function. Why is this dangerous now? What changed between these two version? Best regards, Julian
  27. Hi. The is_reset method is private. So, you cannot call it on an object. But why are you using is_reset() method? What do you want to achieve? This is not part of the standard API, i.e. it might be dangerous to use. Greetings Ralph
  28. hello, i'm facing the same error error: invalid use of incomplete type ‘class sc_core::sc_spawn_options’_files when running the make file in linux i tried to add the command that Philipp wrote above in the terminal... but still having the same error. Can anyone help please?
  29. Hello, i have the following piece of code not compiling: #include <systemc.h> int sc_main(int argc, char* argv[]){ sc_signal<bool> my_signal_bool; sc_reset* my_reset; my_reset = my_signal_bool.is_reset(); return 0; } I get this error: In file included from /usr/local/systemc-2.3.3/include/sysc/communication/sc_buffer.h:34:0, from /usr/local/systemc-2.3.3/include/systemc:79, from /usr/local/systemc-2.3.3/include/systemc.h:219, from ../src/playground.cpp:12: /usr/local/systemc-2.3.3/include/sysc/communication/sc_signal.h: In function ‘int sc_main(int, char**)’: /usr/local/systemc-2.3.3/include/sysc/communication/sc_signal.h:472:23: error: ‘sc_core::sc_reset* sc_core::sc_signal<bool, POL>::is_reset() const [with sc_core::sc_writer_policy POL = (sc_core::sc_writer_policy)0u]’ is private virtual sc_reset* is_reset() const; ^ ../src/playground.cpp:95:37: error: within this context my_reset = my_signal_bool.is_reset(); ^ make: *** [src/playground.o] Error 1 src/subdir.mk:18: recipe for target 'src/playground.o' failed "make all" terminated with exit code 2. Build might be incomplete. I have installed SystemC 2.3.3 and using Eclipse CDT under Ubunut 16.04. How i can resolve this error? Best regards, Julian
  1. Load more activity
×
×
  • Create New...