Jump to content

apfitch

Members
  • Posts

    613
  • Joined

  • Last visited

  • Days Won

    121

Everything posted by apfitch

  1. Probably your driver isn't doing anything. Try putting some printing statements in the driver to debug it, regards Alan
  2. Glad you got it working. .gch is nothing to do with SystemC - try google, regards Alan
  3. In the other thread, Stephan said he successfully compiled and ran your code: http://forums.accellera.org/topic/5446-vcd-file-not-generated/?p=12917 So I don't understand why it doesn't compile and run for you. Perhaps there's a problem with the way you are compiling your code. Try deleting all the object files and starting again. regards Alan
  4. That's because c is connected to an sc_signal. An sc_signal only updates after the process suspends. Probably the neatest solution is to use a variable in your do_and. I'd also move the wait() to the top of the process, otherwise the process will run at time 0 before a and have been assigned. regards Alan void do_and() { bool c_temp; while(true) { wait(); c_temp = a.read()&b.read()); c.write(c_temp); data = 0xFF000000 | (c_temp | 0x00000030); tlm::tlm_generic_payload* trans = new tlm::tlm_generic_payload; sc_time delay = sc_time(10, SC_NS); tlm::tlm_command cmd = tlm::TLM_WRITE_COMMAND; trans->set_command( cmd ); trans->set_address(0); trans->set_data_ptr( reinterpret_cast<unsigned char*>(&data) ); trans->set_data_length( 4 ); trans->set_streaming_width( 4 ); // = data_length to indicate no streaming trans->set_byte_enable_ptr( 0 ); // 0 indicates unused trans->set_dmi_allowed( false ); // Mandatory initial value trans->set_response_status( tlm::TLM_INCOMPLETE_RESPONSE ); // Mandatory initial value socket->b_transport( *trans, delay ); // Blocking transport call //Initiator obliged to check response status and delay if ( trans->is_response_error() ) SC_REPORT_ERROR("TLM-2", "Response error from b_transport"); cout << " a = " << hex << a << " , b = " << hex << b << " , c = " << hex << c_temp << " , data = " << hex << data << " , " << sc_time_stamp() << endl; // wait(); } } By the way, the code you've written is a very strange mixture of TLM and RTL style code :-)
  5. When you say "both ports" you imply two ports. The error message says the *third* port in the object labelled "Waveform" is not bound. Please look for the third port and check it is bound, regards Alan P.S. The ports are automatically named starting from 0, so port_2 must be the third port.
  6. I suggest using SystemC 2.3.1, and the version of TLM2 included in SystemC 2.3.1. You seem to be using an old version of TLM, regards Alan
  7. wait_until and the delayed() method were removed from SystemC during standardisation. The best option is to use a do...while e.g. do { wait(); } while (reset.read() == false && enable.read() == false); regards Alan
  8. Did you download the example from this page: http://www.doulos.com/knowhow/systemc/tlm2/tutorial__1/tlm2_1_downloads.php ? It works for me... SystemC 2.3.1-Accellera --- Nov 18 2015 09:31:09 Copyright (c) 1996-2014 by all Contributors, ALL RIGHTS RESERVED trans = { R, 20 } , data = aa000029 at time 0 s delay = 10 ns trans = { R, 24 } , data = aa0000cd at time 10 ns delay = 10 ns trans = { R, 28 } , data = aa0000ba at time 20 ns delay = 10 ns trans = { R, 2c } , data = aa0000ab at time 30 ns delay = 10 ns trans = { R, 30 } , data = aa0000f2 at time 40 ns delay = 10 ns trans = { W, 34 } , data = ff000034 at time 50 ns delay = 10 ns trans = { R, 38 } , data = aa0000e3 at time 60 ns delay = 10 ns trans = { R, 3c } , data = aa000046 at time 70 ns delay = 10 ns trans = { R, 40 } , data = aa00007c at time 80 ns delay = 10 ns trans = { R, 44 } , data = aa0000c2 at time 90 ns delay = 10 ns trans = { R, 48 } , data = aa000054 at time 100 ns delay = 10 ns trans = { W, 4c } , data = ff00004c at time 110 ns delay = 10 ns trans = { R, 50 } , data = aa00001b at time 120 ns delay = 10 ns trans = { R, 54 } , data = aa0000e8 at time 130 ns delay = 10 ns trans = { R, 58 } , data = aa0000e7 at time 140 ns delay = 10 ns trans = { R, 5c } , data = aa00008d at time 150 ns delay = 10 ns regards Alan
  9. Should your code be cout<<"ff["<<i<<"]"<<ff[i] <<endl; ? Alan
  10. The TLM function calls use an array of character. What I suggest you do is actually use a character, then it will be easier to understand. So in the initiator unsigned char c_char[4]; while(true) { c_char[0] = a.read()&b.read(); c.write(c_char[0]); ... trans->set_data_ptr( c_char); I.e. put the boolean value into byte 0 of an array of 4 bytes. Then you don't need the reinterpret_cast etc, regards Alan
  11. It's not clear to me from your description - does the file exist? If you do ls can you see it? Alan
  12. What are you trying to do with this line? trans->set_data_ptr( reinterpret_cast<unsigned char*>(&c) ); It looks strange to me. c is class sc_out<bool> so casting "pointer to sc_out<bool>" to "pointer to unsigned char" doesn't make sense to me? Alan
  13. You need to bind the sockets in sc_main initiator.socket(memory.socket); Also your do_and thread needs an infinite loop inside it i.e. void do_and() { while(true) { // your code here } } regards Alan
  14. Hi Huy, I realised I did not read your code properly. You have an instance Top *and* you have instances of Initiator and Memory in your sc_main. I think the way you have written your code, you do not need Top. So if you take out Top and also take out the socket declarations in sc_main that is better. regards Alan
  15. This code in sc_main is wrong. tlm_utils::simple_target_socket<Memory> socket1; tlm_utils::simple_target_socket<Initiator> socket2; You just need to bind the sockets directly, e.g. initiator.socket(memory.socket); regards Alan
  16. Probably the most readable thing would be to read into a temporary variable, manipulate it, then write back. E.g. sc_lv<8> temp = dummy; temp[2] = SC_LOGIC_1; dummy.write(temp); The main thing you need to think about is that in VHDL each element of a signal of type std_logic_vector is itself a signal (of type std_logic). In SystemC that's not true. sc_signal <sc_lv<8> > s is a single signal s containing data of type sc_lv<8>. You can't do s[2], but you can do s.read()[2]. The [], concat(), and range() methods belong to the data type, not to the signal class, regards Alan P.S. You can also run into issues with concat() and range() because they don't return the data type you think they do (i.e. sc_lv<> in the example I gave), they return proxy classes, which you sometimes need to cast.
  17. The only thing that looks weird to me is that you're calling b_transport with an argument sc_time(SC_ZERO_TIME). What happens if you call it with just SC_ZERO_TIME? The error message seems to be saying it's looking for a function prototype that takes an argument passed by value rather than by reference, so perhaps calling the copy constructor explicity is confusing something? Alan
  18. I'm not sure what you mean. You could change the printing code to use an SC_THREAD, and then you could add a small wait to allow the outputs to settle. And make the printing process only sensitive to sum, e.g. #include "half_adder.h" SC_MODULE (full_adder) { sc_in<bool>a,b ,cin; sc_out<bool>sum,carry; sc_signal<bool> c1,c2,s1; void disp() { while (true) { wait(1, SC_NS); cout<<"a="<<a<<endl; cout<<"b="<<b<<endl; cout<<"cin="<<cin<<endl; cout<<"sum="<<sum<<endl; cout<<"carry="<<carry<<endl; cout<<endl; } } ... SC_CTOR(full_adder){ ... SC_THREAD(disp); sensitive <<sum; } ... }; regards Alan
  19. It's hard to say. One obvious issue is that if sum and carry change on different delta cycles, you'll see two printouts, Alan
  20. Not as far as I know. If you haven't found it already, you might want to look at http://www.embecosm.com/appnotes/ean1/ean1-tlm2-or1ksim-2.0.html regards Alan
  21. Pass the port name to the port using the constructor argument. Or pre-process your code using a script such as this... http://www.doulos.com/knowhow/systemc/utilities/naming_ports_and_signals/ regards Alan
  22. It's interesting that table 21-12 in the SV2012 does not show a size for real. I don't know if that's significant, Alan
×
×
  • Create New...