Jump to content

All Activity

This stream auto-updates     

  1. Past hour
  2. Well, in TLM1.0 there is even a tlm::tlm_fifo channel which provides something similar what you use. The sockets defined in TLM2.0 are more geared towards memory-mapped busses and provide facilities to model for speed (DMI, loosly-timed blocking interfaces) or accurracy (approximately-timed non-blocking interfaces). To achive this with pure SystemC provided classes takes some effort and it ends to be proprietary... BR -Eyck
  3. Today
  4. Hey guys, Need help about this: Exception thrown at 0x00007FFC1FCE1CAF (ntdll.dll) in mytest.exe: 0xC0000005: Access violation reading location 0x0000000000000000. I traced the call stack to where it stopped in my code, found it's this line in header file: sc_vector<sc_signal<float>> output_connect_wire{"output_connect_wire",1}; It's been used like this in cpp file, not sure if it's relevant though: .... submodule->O_data(output_connect_wire); .... if(...){...} else { data_out.write(output_conncet_wire[0].read()); } .... where the submodule output declared as sc_vector<sc_out<float>> O_data{"O_data",1}; Thank you in advance and tell me if you need any more info to identify the issue.
  5. Hi eyck, Thank you for the answer. Bu with respect to point 2 of your answer i.e producer ,consumer and fifo example.If i am using read or write operation then its a higher abstraction level and i am aware about it .But where does this concept of initiator ,target and socket comes? Though i am feeling like both are same,but exactly i dont know why should i use them . I had read it that system c and tlm combinedly will be helpful in architecture exploration and performance modelling. Ok ,so acc. to my understanding now, i can relate prod,cons,and fifo to a tlm standard.In tlm , we will be using packet as generic transaction,we are having initiator which will use any of the interface methods like blocking,non blocking and what about the function which we need to implement ?,where will i put that function ? Thanks for the example suggestion, i will look into it. Regards, Shubham
  6. Yesterday
  7. Teddy Minz

    Synthetizable FFT function in SystemC

    Thanks a lot @Roman Popov !
  8. Roman Popov

    Synthetizable FFT function in SystemC

    From SystemC standard: SystemC requires that you add sc_module_name as a parameter to module constructors, like this: MULT(sc_module_name, int var_a, int var_b); MULT(sc_module_name); This is a hack that allows SystemC kernel to track lifetime of constructor.
  9. Hi, TLM2.0 is used to model bus-like transactions as you have in APB, AHB, AXI or alike. It abstracts those transactions in to e.g. read and write with some attribites (liek protection and alike). This saves some from dealing with bit wiggling and, as you have less events, improves simulation performance. If you use in your scenarion fifo between your producer and consumer you are already using TLM as you abstract the transmission of more or less complex data as a write into the fifo. If you keep this style in your design you do transaction level modeling (TLM). If you are asking if it makes sense to use the TLM2.0 standard is a different question and depends on what aspects of your design do you need to represent in your model. If you have some kind bus structure (e.g. some micro processor or controller) then it is highly advisable to use TLM2.0. In that case your producer calls the transfer functions of the initiator socket and your consumer needs to react on the callbacks of the target socket. Actually this does not relate to your file structure but as a starting poitn I would suggest to study the lt example comign with the SysetmC distribution. You will find it under examples/tlm/lt, it contains 2 initiator_top mdouels, a bus and 2 lt_target modules. if you reduce the thing to just one initiator_top and one lt_target being directly connected you have your producer/consumer scenario. HTH
  10. Teddy Minz

    Synthetizable FFT function in SystemC

    Hi everyone, Thanks to you, I was able to advance. I have follow your advice and I succeeded to synthesize a FFT function in pure C++ with Vivado HLS. Now, I would like to insert this function in a structure SystemC. For do this I have create a little project "multiplication" . But I think I have difficulties to understand the "SC_CTOR"... I have try to create standard constructor like in C++ but SystemC don't like my constructor ^^ module.cpp #include "module.h" using namespace std; void MULT::multiplication(void) { result = A * B; } void MULT::afficherResult() const { cout << A << " * " << B << " = " << result << endl; } MULT::MULT() : A(4), B(5), result(0) {} MULT::MULT(int var_a, int var_b) : A(var_a), B(var_b), result(0) {} module.h #include "systemc.h" #include <iostream> SC_MODULE(MULT) { public: // Constructeur MULT(int var_a, int var_b); MULT(); //SC_CTOR(MULT); void multiplication(void); void afficherResult() const; private: int A, B, result; }; main.cpp #include "module.h" int sc_main(int argc, char* argv[]) { MULT mult1; mult1.multiplication(); // Print result mult1.afficherResult(); return 0; } With this code I have the following error : Error: (E533) module name stack is empty: did you forget to add a sc_module_name parameter to your module constructor? Why this code work if I declare a classic C++ class but it doesn't with a SC_MODULE? With SystemC we cannot create constructor like that ? Best regards
  11. To be clear: I cannot use `uvm_blocking_transport_imp_decl(SFX) macros, because I need to use TLM2 sockets at the UVM-SV side.
  12. Thanks David, but I already know about the SystemC side 🙂 I'm looking for possibilities in the UVM-SV space (hence the post in "UVM SystemVerilog Discussions").
  13. Hi, I was having few basic doubts regarding tlm,I am using system c again after few months. I wanted to know ,how exactly tlm is being used.I know the basics of system c and was approaching to start with tlm. I had googled to see few of tlm uses,but i was not able to catch up those points. I want to know under this scenario,like if i had modelled a system in system c and was having 5 files,design.cpp,producer.cpp,consumer.cpp,top.cpp,main.cpp .I would have used threads as function and called at particular time and would do the communicvation between modules.But what about tlm,as i had read in tlm we are having initiator and target and there are different types of interface connections which can be used for communication. But my question here would be,how and where would i put those 5 files when commuication mode being used is tlm.Do i need to model producer as initiator & vice versa & use any of the interface method of tlm or what !? Any help would be appreciated a lot. Thank you. Regards, Shubham
  14. Last week
  15. By using convenience sockets, you can bind each socket to a different function (names will have to be different because the argument types are the same). Thus, twotarg.hpp: // Example code with two target sockets and separate implementations #ifndef TWOTARG_MODULE_HPP #define TWOTARG_MODULE_HPP #ifndef SC_INCLUDE_DYNAMIC_PROCESSES #define SC_INCLUDE_DYNAMIC_PROCESSES #endif #include <tlm> #include <tlm_utils/simple_target_socket.h> #include <cstdint> // Specific symbols for convenience using sc_core::sc_time; using sc_core::sc_event; struct Twotarg_module: sc_core::sc_module { // Type definitions to improve readability using tlm_payload_t = tlm::tlm_generic_payload; using tlm_phase_t = tlm::tlm_phase; using tlm_peq_t = tlm_utils::peq_with_cb_and_phase<Twotarg_module>; // Sockets, ports and exports tlm_utils::simple_target_socket<Twotarg_module> targ_socket_2{ "targ_socket_1" }; tlm_utils::simple_target_socket<Twotarg_module> targ_socket_2{ "targ_socket_2" }; Twotarg_module ///< Constructor ( sc_core::sc_module_name instance_name ); ~Twotarg_module( void ); ///< Destructor (allow PIMPL) virtual const char* kind( void ) const override { return "Twotarg_module"; } private: //---------------------------------------------------------------------------- // Forward interface void b_transport_1( tlm_payload_t& trans, sc_time& offset ); void b_transport_2( tlm_payload_t& trans, sc_time& offset ); private: Twotarg_module( const Twotarg_module& ) = delete; Twotarg_module& operator=( const Twotarg_module& ) = delete; }; #endif /*TWOTARG_MODULE_HPP*/ and twotarg.cpp: //File: twotarg.cpp #include "twotarg.hpp" namespace { const char* const MSGID{"/Doulos Inc./Example/Twotarg"}; } using namespace sc_core; using namespace tlm; using namespace std; //------------------------------------------------------------------------------ Twotarg_module::Twotarg_module // Constructor ( sc_module_name instance_name ) { targ_socket_1.register_b_transport ( this, &Twotarg_module::b_transport_1 ); targ_socket_2.register_b_transport ( this, &Twotarg_module::b_transport_2 ); } //------------------------------------------------------------------------------ // Destructor Twotarg_module::~Twotarg_module( void ) { } //////////////////////////////////////////////////////////////////////////////// // Forward interface //------------------------------------------------------------------------------ void Twotarg_module::b_transport_1 ( tlm_payload_t& trans , sc_time& delay ) { SC_REPORT_INFO_VERB( MSGID, "Not yet implemented", SC_NONE ); ///< replace this line // TO BE SUPPLIED // Check attributes // Perform transaction } //------------------------------------------------------------------------------ void Twotarg_module::b_transport_2 ( tlm_payload_t& trans , sc_time& delay ) { SC_REPORT_INFO_VERB( MSGID, "Not yet implemented", SC_NONE ); ///< replace this line // TO BE SUPPLIED // Check attributes // Perform transaction } /////////////////////////////////////////////////////////////////////////////// // Copyright 2019 by Doulos Inc.. All rights reserved. //END twotarg.cpp
  16. In SystemC, we have the possibility to bind a specific b_transport function to a specific target socket. Hence, I can create a module with multiple target sockets that each bind to their own b_transport implementation. Reading the UVM user's guide v1.2 chapter 2.47 (TLM2 - Use Models), I get the impression that there exists an implicit binding between all target sockets of a module and one b_transport implementation. In other words, we can only have one b_transport function per uvm_component. Is that correct, or is there a way to implement and bind different b_transport implementations to different target sockets?
  17. shubham_v

    d flipflop output

    Hi deepti, ok,i got it. Thanks for the help. Regards, Veeresh k
  18. Earlier
  19. SDeepti

    d flipflop output

    No, you need to have loop with the function registered as SC_THREAD. For your code, it will be: void d_operation() { while(1){ if (reset.read()==1) { d_out = 0; // std::cout << "reset= " << reset << "...din= " << d_in << ".....d_out" << d_out << std::endl; } else { //d_out.write(d_in.read()); d_out=d_in; // wait(1, SC_NS); // std::cout << "reset= " << reset << "...din= " << d_in << ".....d_out" << d_out << std::endl; } wait(); } }
  20. Roman Popov

    Synthetizable FFT function in SystemC

    If you code your FFT as a pure C++ function, Vivado HLS will generate inputs and outputs automatically from function parameters and based on INTERFACE pragmas. And you can import generated RTL into Vivado IP integrator. Check out Xilinx documentation, and ask on Xilinx forums. Please also note that you can implement FFT in a various ways (with different micro-architectures), and achieve various performance vs area numbers. And HLS also requires quite a lot of learning to achieve good results.
  21. Teddy Minz

    Synthetizable FFT function in SystemC

    I didn't use Xilinx's LogiCore because I want to compare the execution time of a VHDL design generated from SystemC-encoded FFT block with the execution time of a FFT block on CPU and precisely with a design who use Xilinx's IP. The objective isn't to have high accuracy but just an order of magnitude between this 3 methods. At the base I didn't want to reinvent the wheel. I thought I could get a SystemC-encoded FFT block and compared it fairly quickly. Excuse me, my questions are maybe silly but I really want to understand. If I code a FFT in pure C++ shall I have problems for testing ? When I code in SystemC I can declare input/output with "sc_in" and "sc_out" and I find them when I import my IP within Vivado. How I can do that in pure C++ ?
  22. shubham_v

    d flipflop output

    Hi deepti, Thanks for your reply. I have tried the other examples also,but tats the commmon issue iam facing of not getting output. By infinite loop, you mean to say i need to put sc_start(-1) which in turn makes my thread to run forever. As far as my problem is concerned,even for combinational circuits if iam using sc_method ,i am not getting the desired output. Update:-Started writing the fresh code and i am getting some ouput now.Some issues are there with respect to timing,but i think it can be resolved. Regards, Shubham
  23. David Black

    Heartbeat, clock and negedge

    No specific guidelines or cookbooks; however, it is really quite straightforward to think about. First, you need to think about contributors to slow down. Some of the worst are: I/O - for example printing out values every time something changes. During debug this may be helpful, but once it's working drop the messaging. Use SC_REPORT_INFO_VERB with appropriate verbosities (e.g. DEBUG). Context switching - every call to wait() implies a context switch. This also applies to returns from SC_METHODs. Second, when you have working code, you need to do code profiling to see where time is being spent. Then think about how to reduce it. Common mistakes: Coding at too low a level of abstraction - NO RTL please Trying to outwit the compiler with "more efficient coding" Using C rather than C++ techniques (e.g. implementing a linked list rather than using appropriate STL containers) Preferring SC_METHOD over SC_THREAD because of the myth that it will be faster (and wasting a lot of coding time doing it) Using sc_clock
  24. David Black

    Synthetizable FFT function in SystemC

    I agree with @Roman Popov on the choice of inputs to the HLS tool. The sweet spot for Vivado_HLS is C++. Much simpler to code for most folks. That said, it can be done. Why wouldn't you want to use Xilinx' Logicore though? One of the best ways of raising the level of abstraction (which is what using C++ or SystemC do) is to reuse somebody else's effort. Tested and probably fairly optimized. Otherwise, you are effectively reinventing the wheel.
  25. SDeepti

    d flipflop output

    You have registered d_operation() as a thread. Ideally a thread should have an infinite loop and a wait(). Adding that, you can see changes to your d_out. Also, how about having another thread that does the reset job?
  26. Roman Popov

    Synthetizable FFT function in SystemC

    Xilinx HLS tools have very limited SystemC support, you should probably code your FFT in pure C++.
  27. David Black

    Triggering a method upon change in value of port

    Show some code. [Use the code quotations <> above and specify language C/C++] What do you mean by "input port"? Are you using the default sc_port or specialized signal port? Have you registered the method? Where are you using value_changed_event()? Why are you using `operator.` rather than operator-> ?
  28. Hi All, I am using an input port of type double to trigger my method. Irrespective of whether I give dont_initialize() property to the method or not, the method is getting triggered once during initialization phase. It is not triggering when there is a change in the value of the port to which the method is sensitive to. I also tried giving .value_changed_event() to the port. How should I handle this? Thanks in advance for your inputs Best Regards, Karthik Rao
  1. Load more activity
×