Jump to content

DS1701

Members
  • Posts

    62
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by DS1701

  1. Hello @all Description: I have 2 input port sc_in<Data> input[2]; 2 method "HandleInput(int port_index)" (using sc_spawn) with sensitive is input port 1 method "MainProcess" "HandleInput" method will trigger "MainProcess" with main_process_event.notify(SC_ZERO_TIME) Symptom : "HandleInput" is called 2 times ( port_index = 0 and 1) at the same time (It is called before "MainProcess" is called ) "MainProcess" is called 2 times -> This is not desirable, My expected is "MainProcess" is called 1 time I tried to reproduce it with the simple code ( as my attached), but I can't As my check: 1. "HandleInput" with port index = 0 is called -> main_process_event.notify(SC_ZERO_TIME) is called -> m_notify_type = DELTA -> sc_event::trigger() is called 2. "HandleInput" with port index = 1 is called -> main_process_event.notify(SC_ZERO_TIME) is called .... Because at (1) : sc_event::trigger() is called => m_notify_type = NONE => So, at (2), when main_process_event.notify(SC_ZERO_TIME) is called, kernel add new delta event => MainProcess triggered 2 times But I don't know why at(1) sc_event::trigger() is called ?, I think (1) and (2) are same phase (Evaluate), I don't know this is a systemc bug or not? Could you please to support? BRs DUT.cpp main.cpp
  2. hi @David Black, I posted my code to https://www.edaplayground.com/x/Nn9e Thank you so much
  3. Thank @Eyck and @David Black for your information, I tried with your method by change : sc_event ev_wait => ThreadSafeEvent ev_wait; but It still not work. notify() is called but update() function isn't called. Maybe something wrong. note: If I use ThreadSafeEvent instead of sc_event , I can't using wait(event). Do you have another way? Thanks for your kind words header.h pthread_function.c Source.cpp
  4. Hi all, I'm trying to build source code using pthread and SystemC ( SystemC build as quickThread) Step 1 : Create pthread tmodule->threadID[i] = i; result_code = pthread_create(&tmodule->thread[i], NULL, perform_func, (void*)tmodule); Step 2 : Kick a thread to wait event void wait_thread() { while (1) { wait(ev_wait); //wait(wait_time_val, SC_NS); cout << "@" << sc_time_stamp() << " :: " << "Waiting " << wait_time_val << " second." << endl; resume_thread(); } } In perform_func will call to void wait_time_func(double val) { wait_time_val = val; ev_wait.notify(SC_ZERO_TIME); } Although ev_wait.notify() called but wait_thread cannot reach event. Could you please help me about this issue?? Note : I'm running on VS2015 windows Thank you so much. header.h pthread_function.c Source.cpp
  5. 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
  6. I have a simple code as bellow: class Tmodel{ private: sc_event notify_method_2; sc_event notify_method_4; public: sc_event notify_method_3; sc_in<bool> input_port; ... SC_METHOD(method_1); dont_initialize(); sensitive << input_port; SC_METHOD(method_2); dont_initialize(); sensitive << notify_method_2; SC_METHOD(method_3); dont_initialize(); sensitive << notify_method_3; SC_METHOD(method_4); dont_initialize(); sensitive << notify_method_4; ... void method_1(void){ ... notify_method_2.notify(SC_ZERO_TIME); } void method_2(void){ ... printf("method_2\n"); } void method_3(void){ notify_method_4.notify(SC_ZERO_TIME); } void method_4(void){ printf("method_4\n"); } }; int sc_main(int , char *){ ... objectDUT->input_port.write(true); objectDUT->notify_method_3.notify(SC_ZERO_TIME); sc_start(200,SC_PS); ... } when debug, steps as bellow: 1. method_1 , call notify_method_2 2. method_3, call notify_method_4 3. method_4 4. method_2 I dont understand why at step 3 is method_4 ( I think it is method_2 ). if in sc_main, I insert sc_start(0,SC_PS); int sc_main(int , char *){ ... objectDUT->input_port.write(true); sc_start(0,SC_PS); objectDUT->notify_method_3.notify(SC_ZERO_TIME); sc_start(200,SC_PS); ... } steps is correct: 1. method_1 , call notify_method_2 2. method_3, call notify_method_4 3. method_2 4. method_4
  7. hi @Philipp A Hartmann I get the following message: ==25661== 16 bytes in 1 blocks are possibly lost in loss record 1,400 of 14,166 ==25661== at 0x402B9B4: operator new(unsigned int) (vg_replace_malloc.c:333) ==25661== by 0x40D8AB3: sc_core::sc_port_base::make_sensitive(sc_core::sc_method_process*,sc_core::sc_event_finder*) const (in /usr/lib/i386-linux-gnu/libsystemc-2.3.1.so) ==25661== by 0x40D8C41: sc_core::sc_sensitive::operator<<(sc_core::sc_port_base const&) (in /usr/lib/i386-linux-gnu/libsystemc-2.3.1.so) ==25661== Address 0x5C2BB94 is 32 bytes inside a block of size 57 free'd ==25661== at 0x302B9B4: operator delete(void *) (vg_replace_malloc.c:575) ==25661== by 0x30D8AB3: _M_dispose (basic_string.h:249) ==25661== by 0x30D8AB3: _basic_string (basic_string.h:547) ...(my model) ==25661== by 0x30D8AB3: sc_core::sc_simcontext::simulate....(in /usr/lib/i386-linux-gnu/libsystemc-2.3.1.so) ==25661== by 0x30D8AB3: sc_core::sc_start....(in /usr/lib/i386-linux-gnu/libsystemc-2.3.1.so) Is it same with your previous answer? or other reason.
  8. In my case: I bind directly initiator and target iSocket(tSocket); when target receive transaction, it will copy data to payload unsigned char data[1024]; for (unsigned int i = 0; i < NUM_MAX; i++) { data[i] = i ; } memcpy(trans.get_data_ptr(), &data, length); with length = 128, Initiator read 128 byte from "trans", and I get 0, 1, 2, 3, 4,...127 I think if BUSWIDTH = 32 then I only get 0 ,1 ,2, 3, 0, 0, 0, 0.... It is mean, Initiator can get 128 bytes, in spite of BUSWIDTH= 32, So, I'm not clarify about BUSWIDTH
  9. Hi all, I dont know what is mean using Bus width when declare a socket. eg: model A has an initiator socket : tlm::tlm_initiator_socket<32,tlm::tlm_base_protocol_types,0> iSocket; //BUSWIDTH = 32 model B has a target socket : tlm::tlm_target_socket<32,tlm::tlm_base_protocol_types,0> tSocket; //BUSWIDTH = 32 iSocket will bind with tSocket. when I issue a transaction from model A to model B with trans.set_data_length(128); // 128 > BUSWIDTH I received 128 byte data, What is mean BUSWIDTH when I declare a socket?
  10. Hi all, I have 2 models, model A and model B Model A has an output port out_A (bool) Model B has an input port in_B (bool) when integrate, I will instance 3 objects of Model A, 1 object of Model B //file @connection.cpp ... void initializeENV(){ ... objA_1 = new ModelA("objA_1"); objA_2 = new ModelA("objA_2"); objA_3 = new ModelA("objA_3"); objB = new ModelB("objB"); ... } the value of in_B = objA_1->out_A or objA_2->out_A or objA_3->out_A I think that, if I bind as below . It is wrong. Because of when objA_1->out_A is change then affect to obj_2->out_A and objA_3->out_A. Is my understand correct? //file @connection.cpp ... sc_signal<bool> sig_1; sc_signal<bool> sig_2; sc_signal<bool> sig_3; void initializeENV(){ ... objA_1 = new ModelA("objA_1"); objA_2 = new ModelA("objA_2"); objA_3 = new ModelA("objA_3"); objB = new ModelB("objB"); objA_1->out_A(sig_1); objA_2->out_A(sig_2); objA_3->out_A(sig_3); objB->in_B(sig_1); objB->in_B(sig_2); objB->in_B(sig_3); ... } How to resolve it? How to bind 3 out_A ports to in_B port? .I can't use SC_METHOD in this case. Thank all.
  11. Master and Slave use same clock, so I think Slave need only care data_in. class slave : public sc_module { public: sc_in<bool> clk; sc_in<uint32_t> data_in; slave(sc_module_name name):clk("clk"),data_in("data_in"){ SC_HAS_PROCESS(slave); SC_METHOD(run); dont_initialize(); sensitive << data_in; } void run(){ cout<<hex<<data_in.read()<<endl; } ~slave(){ } }; or class slave : public sc_module { public: sc_in<bool> clk; sc_in<uint32_t> data_in; slave(sc_module_name name):clk("clk"),data_in("data_in"){ SC_HAS_PROCESS(slave); SC_THREAD(run); dont_initialize(); sensitive << data_in; } void run(){ cout<<hex<<data_in.read()<<endl; } ~slave(){ } };
  12. I'm sorry make you confused. Summary: if my test case is: sc_start(2*period,time_unit); while (sc_pending_activity_at_current_time()) { sc_start(SC_ZERO_TIME); } or sc_start(3*period,time_unit); then compare match occur.( is correct) If my test case is: sc_start(2*period,time_unit); then compare match don't occur . I want to my source code detect when time simulate near the over to pending to execute event m_update before over.
  13. i try : void GTimer::end_of_simulation() { while (sc_pending_activity_at_current_time()) { sc_start(SC_ZERO_TIME); } } But It is not true? My problem is the time simulates is over before trigger event. I want to force trigger event before end simulate.
  14. Thanks @Philipp A Hartmann it is OK if I use : sc_start(2*period,time_unit); while( sc_pending_activity_at_current_time() ) sc_start( SC_ZERO_TIME ); But I want to pending in my code. Is it possible?
  15. Thank @Eyck I understand that. Do you have any idea for this problem? How to resolve? Thanks very much.
  16. Hi all, I'm using systemC to build timer model. ( Timer support compares match, overflow, underflow) //constructor SC_METHOD(evaluate_method); dont_initialize(); sensitive << m_evaluate; SC_METHOD(update_method); dont_initialize(); sensitive << m_update; void GTimer::evaluate_method() { //check if compare match if(CNT_value == compare_match_value){ compare_match_handling(); } ... m_update.notify((double)period * compare_match_value, time_unit); } void GTimer::update_method() { CNT_value = get_counter_value(); m_evaluate.notify(); } GT_API unsigned int GTimer::get_counter_value() { unsigned int value; sc_time current_time = sc_time_stamp(); value = (current_time.to_double() - start_time.to_double()) / period; return value; } Ex: I set compare_match_value = 2; period = 1000.0 time_unit = SC_PS when I start timer and simulate on 2* period sc_start(2*period ,time_unit) compare match don't occur. because the time simulate is over but m_update event not trigger. If I start timer and simulate on 3* period compare match occur. Do you have any idea? ( I want to compare match occur when I start timer and simulate on 2*period) Thank all.
  17. Hi @CapUnderPantsRLZ in 1666-2011.pdf So, I think @David Black is exactly. https://stackoverflow.com/questions/45308468/systemc-multiple-module-implementations-in-single-cpp-file
  18. Thank you so much, @David Black
  19. Hi all, I try code bellow SC_METHOD(APMMethod); sensitive << mAPMEvent; ... void APMMethod(){ printf("Reset port\n"); ... } ... void Initialize() { for(unsigned int i=0; i< 50; i++){ mAPM_reg[i].value = 0; printf("Initialize %s\n",mAPM_reg[i].name); } } ... void EnableReset(){ //reset port mAPMEvent.notify(SC_ZERO_TIME); //initialize reg Initialize(); } When EnableReset occur. My output is: Intialize APM_REG1 Intialize APM_REG2 ... Reset port I try with mAPMEvent.notify(); But the same output. 1. why Initialize() call before APMMethod(). 2. when to use notiffy() or notify(SC_ZERO_TIME)? Thanks all.
  20. I can't see that because my lib is 2.3.1. So, with 2.3.1, we don't have a solution. Thank Philipp.
  21. Hi @David Black, If I have sc_event event1; sc_event event2; ... SC_METHOD( My_method ); sensitive << event1 << event2; dont_initialize(); How to detect My_method sensitive by event1 or event2?
  22. Hi all, Can you explain about ideas of "Timing annotation", "Temporal decoupling", "Quantum keeper"? How do you use it?.
  23. sensitive<< rd_addr I think above code is illegal. You can declare event. If new value rd_addr != old value rd_addr then notify event .
×
×
  • Create New...