Jump to content


  • Content Count

  • Joined

  • Last visited

About scsc

  • Rank

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. But fir_data.h in SystemC's example folder used similar coefficient declaration: SC_CTOR(fir_data) { SC_METHOD(entry); dont_initialize(); sensitive << reset; sensitive << state_out; sensitive << sample; #include "fir_const.h" }
  2. It seemed different behavior when putting a constant array inside the SC_CTOR vs. in process function. For example, SC_CTOR(ex) { ... double angles[28]; SC_METHOD(entry); double angles[28] = {...} } vs. void ex::entry() { double angles[...] = {...}; } When putting constant array inside SC_CTOR, the readout values aren't correct. They are like huge numbers to power of 63. The second way had correct readout values.
  3. Thanks again Eyck. I confirmed that #define N was the culprit. I can run the example after changing N to something else (along with a typo in the typedef line). This is a tricky one. But the errors made sense looking back as there is "int N" in sc_fixed template
  4. Thanks Eyck, I tried to use double input for an sc_fixed data type (see the attached example). Somehow the direct assignment didn't work. Or because the errors I got were from sc_port.h, which has not been used at all. So I wasn't sure the direct assignment actually works. #define SC_INCLUDE_FX #define N 25 #include <systemc.h> using namespace sc_core; using namespace sc_dt; typedef sc_fix<32, 16, SC_RND> fixed_type; double fix_fir(double _in[]) { fixed_type in[N], c[N], t[N], y; int i; double ct = 0.9987966; fo
  5. I dug up this old thread on double(float) conversion to sc_bv: Apparently we can convert a double to sc_ieee_double (see the snippet below from that post) then manually convert to sc_fix(ed) from mantissa and exponent or convert to sc_fixed from the bitvector (with some truncation because the bitvector would have different bitwidth to sc_fixed. But just wonder if there are built in methods that perform the conversion to sc_fixed directly? double d = ...; sc_dt::scfx_ieee_double id(d); // convert to IEEE 754 bitfield // prepare parts bool sgn = id.negative();
  6. Ah, thanks Eyck. It works! Apparently I didn't read the LRM ...
  7. This must be a very simple issue but ... So I had narrowed down to this simple function: #include <systemc.h> void test_overflow_modes() { sc_fixed<6, 4> a = -7; cout << " a in dec: " << a << endl; } int sc_main(int argc, char* argv[]) { test_overflow_modes(); sc_start(); return 0; } VS2017 had compilation error: Error (active) E0020 identifier "sc_fixed" is undefined. I checked my installation under /src/sysc/datatypes/fx and saw sc_fixed.h but not sc_fixed.cpp. And I recal
  8. Thanks for pointing the binding process out. I do see slave_port is being used.
  9. Yes, I figured this one out by inserting a process ...
  10. sc_port<simple_bus_slave_if, 0> slave_port; In the above snippet, how many slave_port copies of simple_bus_slave_if are initialized, given N=0? The default of sc_port is N=1.
  11. Cool, thanks. That definitely helps. Appreciate it.
  12. I modified an example (similar to SystemC's simple_fifo example) to have sc_interface to write/read stack. There is no error and can run. But the characters are all messed up. The display looks like this: SystemC 2.3.2-Accellera --- Nov 1 2018 16:37:26 Copyright (c) 1996-2017 by all Contributors, ALL RIGHTS RESERVED binding C1.port_0 to interface: class stack_read_if binding P1.port_0 to interface: class stack_write_if ╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠╠
  13. That's a quick response. Thanks. p1 and p2 are in an SC_METHOD process so I didn't put in clocks. I checked their contents by printing out their struct values. Could "the next delta cycle" mean a wait()?
  14. I had a struct defined as struct pixel { sc_uint<8> r; sc_uint<8> g; sc_uint<8> b; }; Then I try to pass actual pixel values to the ports, defined as pixel data type in main.cpp sc_signal<pixel> p1; sc_signal<pixel> p2; p1.write(pixel(1, 2, 3)); p2.write(pixel(4, 5, 6)); But it seems p1.write() and p2.write() didn't initialize p1 and p2 correctly as I still see they don't have the expected pixel values (1,2,3) and (4,5,6). Do I need to use sc_interface to pass this customized data type around? Thanks
  • Create New...