Jump to content

apfitch

Members
  • Posts

    613
  • Joined

  • Last visited

  • Days Won

    121

Everything posted by apfitch

  1. I'd assume from your code that you're not actually *declaring* d based on word, in the Verilog d is presumably declared as reg [15:0]. You could write equivalent functionality using an if, e.g. sc_int<16> d, output; void make_output () { // register as an SC_METHOD for (int i = 0; i<15; i++) output[i] = d[8]; if (word) output = d; else output[7:0] = d[7:0]; } regards Alan P.S. There may be an easier way, I just can't think of it at the moment :-)
  2. There isn't an equivalent operator in SystemC. However you appear to be doing sign extension, so as long as you use a signed data type it should "just work", regards Alan
  3. To see the simple sockets described, look at the SystemC 1666-2011 standard, section 16.1.2, especially the first 2 paragrahs regards Alan
  4. The size of each location depends on the template argument. e.g. sc_fifo< sc_biguint<1000000> > fifo; A fifo of depth 16 where each entry is 1 million bits (!) wide, If you use int, then it is typically 32 bits on a workstation, regards Alan
  5. Your first code is correct. How do you know the depth is not working? You should have a depth of 20. What do you get if you do std::cout << cmd_fifo.num_free() << std::endl; in the constructor? You should see 20 printed I hope, regards Alan
  6. Hi Cam, register_b_transport is a feature of the "simple sockets". The idea of the simple sockets is that you register functions with the socket itself, and then when the user calls b_transport in a simple_target socket, it automatically calls the function you register. The simple sockets are part of the TLM utilities - they are there for your convenience, but are not part of the interoperability layer. Have a look at section 16.1.2 of IEEE 1666-2011 regards Alan P.S. One other thing people often overlook - when you use the simple sockets, you do *not* have to implement the fw_transport_if in your target - it is implemented for you in the simple target socket. P.P.S. The function you register with register_b_transport does not have to be called b_transport - however that would be confusing if you decided to use another name.
  7. That's just C++ - you need to allocate the memory in the constructor, and de-allocate it in the destructor, regards Alan P.S. Another way I find is useful to help remember things like this is that sequential code in C/C++ really belongs in a function. So writing this: host_hci_pkt_arr = new(nothrow) unsigned char [2]; host_hci_pkt_arr[0] = 0x01; host_hci_pkt_arr[1] = 0x02; in a class doesn't make sense, it belongs in a function (in this particular case the class constructor).
  8. The short answer is "no". Though some University did work on a parallel implementation (sorry I can't remember which one). There is interest in the Language Working Group. Current implementations of SystemC run as a single thread. Pthreads or Quickthreads are used to emulate parallel threads, but running within a single OS thread. regards Alan
  9. On Windows, you might find this useful: http://msdn.microsoft.com/en-us/library/windows/desktop/aa366778%28v=vs.85%29.aspx especially the /LARGEADDRESSAWARE linker option, regards Alan
  10. Hi Kasturi, I didn't reply because I don't really understand what your question is - but I'll see if I can understand better. Answer number 1 SystemC is just C++. Just run your program at the command line. Print out messages when you send and receive each transaction. Inspect the results using your brain (or your mind? or both?) Answer number 2. Are you asking if you have implemented the protocols correctly? In that case both Jeda and Doulos have TLM2 protocol checkers which you can instance between your sockets to validate your code. See for instance http://www.doulos.com/knowhow/systemc/tlm2/base_protocol_checker/ Answer number 3. Are you asking about the functionality of what you have modelled? I.e. does it match the thing that you're trying to model? In that case you probably need a reference model to generate expected transactions. regards Alan
  11. You need to write a module that implements the transport interface, but then within the body of the tranport function converts the payload data into pin-wiggles. As it's LT, you could simply block until the transfer completes, regards Alan
  12. sc_module is just a c++ class, so it can have data members of type vector, regards Alan
  13. There are also constructors that take sc_time objects, so you could also do sc_time clock_period(20, SC_US); sc_clock clock("clock", clock_period); if you like, kind regards Alan
  14. That is an obsolete document, I do not recommend using it. It was never a standard. Use the IEEE 1666-2011 standard. If you read that standard, there is a list of deprecated features, including on page 583 the information that default time unit is deprecated. n) Default time units and all the associated functions and constructors, including: 1) Function sc_simulation_time 2) Function sc_set_default_time_unit 3) Function sc_get_default_time_unit 4) Function sc_start(double) 5) Constructor sc_clock(const char*, double, double, double, bool) No, there is no default time unit. You are quoting an obsolete document which was never a standard. However there is a default constructor for sc_clock, which sets the default clock *period* to 1 ns. So if you wrote sc_clock clock; // name is "clock_0", period 1, SC_NS, posedge_first true, delay to first edge 0, SC_NS See the LRM description of sc_clock, p149ff. There is a default time *resolution* of 1 ps. What that means is if you say wait(1.0001, SC_NS); you will lose the fractional part of the time delay as it is less than 1 ps. You can change the *resolution* using sc_set_time_resolution() (see page 102). Yes that works. No that doesn't work. You still have to use 20, SC_US with SystemC 2.1, 2.2, 2.3 (LRM 1666-2005 1666-2011). There is no default time unit. Don't mix up the time resolution (the minimum representable time value) and default time unit (a deprecated feature of SystemC before it was standardised). regards Alan
  15. Hi Zarie, that's what I meant by "you must wait a delta". If no time passes, a primitive channel does not update. Kocha's solution will work (adding a call to sc_start - in fact even sc_start(SC_ZERO_TIME) should work. regards Alan
  16. How do you know the assignment is not working? When are you printing out the assigned value? Remember that you must wait at least a delta for a primitive channel to update. There's more about user defined types and sc_signal here http://www.doulos.com/knowhow/systemc/faq/#q1 regards Alan
  17. Hi Mohit, sorry but I don't believe you :-; The error is saying you are trying to use char as a template class, which implies you've used char<31>, not char[31]. regards Alan
  18. There is no default time unit. You should always specify the time unit, e.g. wait(1, SC_NS); regards Alan P.S. If you really meant time resolution, see section 5.11.3 of IEEE 1666-2011
  19. Don't you mean sc_out< signed char [31] > ? Alan
  20. You can use the range() method. However please note that the range() method belongs to the integer and vector classes, not to the ports. So for instance to pick out the bottom 5 bits you could use input.read().range(4,0) All the available methods are listed in the IEEE 1666-2011 standard, which you can download free via the accellera website. regards Alan P.S. for sc_uint there is only one template argument, so sc_uint<8>, not sc_uint<8,8>.
  21. I'm not sure if I understand your question. But if you send a pointer through your fifo, and you expect to keep the data at the receiver, then you need to take a copy of the data immediately when you receive it. regards Alan
  22. OK, the problem is that you assert the reset for 1 second. At 1400ms (the second RESET), the read_en signal is still true, so the code attempts to read from an empty fifo, and hangs (as you're using a blocking read), regards Alan P.S. One fix is to change the structure to if reset elsif read else write i.e. only go on to attempt a read or write if the reset is not enabled.
  23. Yes, but I don't know the answer :-( Alan
×
×
  • Create New...