-
Posts
613 -
Joined
-
Last visited
-
Days Won
121
Content Type
Profiles
Forums
Downloads
Events
Everything posted by apfitch
-
Probably your driver isn't doing anything. Try putting some printing statements in the driver to debug it, regards Alan
-
Glad you got it working. .gch is nothing to do with SystemC - try google, regards Alan
-
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
-
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 :-)
-
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.
-
problem with doulos's "routing" example
apfitch replied to VanTeo's topic in SystemC TLM (Transaction-level Modeling)
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 -
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
-
doulos's example is fails
apfitch replied to kid123's topic in SystemC TLM (Transaction-level Modeling)
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 -
Can you show us the errors you get please? Alan
- 13 replies
-
- vcd not generated
- generating vcd
- (and 2 more)
-
Should your code be cout<<"ff["<<i<<"]"<<ff[i] <<endl; ? Alan
-
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
-
It's not clear to me from your description - does the file exist? If you do ls can you see it? Alan
- 13 replies
-
- vcd not generated
- generating vcd
- (and 2 more)
-
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
-
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.
-
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
-
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
-
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
-
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
- 7 replies
-
- Virtual Platform
- External Events
-
(and 1 more)
Tagged with:
-
what is always@(*) verilig2001 equivalent syntax in SystemC?
apfitch replied to anindya.hazra's topic in SystemC Language
No. regards Alan -
Issue with bit width for double and float types in VCD tracing
apfitch replied to Stephan Gerth's topic in SystemC Language
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