Jump to content

Search the Community

Showing results for tags 'custom_type'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Accellera Systems Initiative
    • Information
    • Announcements
    • In the News
  • SystemC
    • SystemC Language
    • SystemC AMS (Analog/Mixed-Signal)
    • SystemC TLM (Transaction-level Modeling)
    • SystemC Verification (UVM-SystemC, SCV, CRAVE, FC4SC)
    • SystemC CCI (Configuration, Control & Inspection)
    • SystemC Datatypes
  • UVM (Universal Verification Methodology)
    • UVM (IEEE 1800.2) - Methodology and BCL Forum
    • UVM SystemVerilog Discussions
    • UVM Simulator Specific Issues
    • UVM Commercial Announcements
    • UVM (Pre-IEEE) Methodology and BCL Forum
  • Portable Stimulus
    • Portable Stimulus Discussion
    • Portable Stimulus 2.0 Public Review Feedback
  • IP Security
    • SA-EDI Standard Discussion
    • IP Security Assurance Whitepaper Discussion
  • IP-XACT
    • IP-XACT Discussion
  • SystemRDL
    • SystemRDL Discussion
  • IEEE 1735/IP Encryption
    • IEEE 1735/IP Encryption Discussion
  • Commercial Announcements
    • Announcements

Categories

  • SystemC
  • UVM
  • UCIS
  • IEEE 1735/IP Encryption

Calendars

  • Community Calendar

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Biography


Location


Interests


Occupation


Company

Found 1 result

  1. Dear All, I created a class BusAssembly, which basically contains a matrix of sc_uint<>, and I provided it with operator= , ==, >> and sc_trace. In a simple sc_main I defined some variables with type sc_signal<BusAssembly<W,Dim0,Dim1> > . Then I assinged them with a static matrix. (Both by = or .write()) Now, the new_value of the sc_signal variables is correctly assigned, but after a while of simulaiton, their current value is not updated to it. Surprisingly it is only working for the fisrt assignment occurrence. SystemC 2.3.1-Accellera --- Sep 20 2014 12:00:32 Copyright (c) 1996-2014 by all Contributors, ALL RIGHTS RESERVED data1 (5,1,1,1,1,1) name = signal_0 value = (5,1,1,1,1,1) new value = (5,5,3,1,2,3) data2 (1,1,1) name = signal_1 value = (1,1,1) new value = (1,64,130) data1 (5,5,3,1,2,3) <-- After simulation data1 is OK name = signal_0 value = (5,5,3,1,2,3) new value = (5,0,0,0,0,0) data2 (1,1,1) <-- data2 is not name = signal_1 value = (1,1,1) new value = (1,0,0) data1 (5,5,3,1,2,3) <-- data1 is not name = signal_0 value = (5,5,3,1,2,3) new value = (5,0,0,0,0,0) data2 (1,1,1) <-- neither data2 name = signal_1 value = (1,1,1) new value = (1,0,0) What am I mistaken with ? Thank you in advance. Please find here the sc_main code: #include <iostream> #include "frames.h" using namespace std; int sc_main(int argc, char *argv[]) { // Testbench internal variables static const sc_uint<4> a[5][1] = {{5},{3},{1},{2},{3}}; static const sc_uint<4> b[5][1] = {{0},{0},{0},{0},{0}}; static const sc_uint<8> c[1][2] = {{64,130}}; static const sc_uint<8> d[1][2] = {{0,0}}; sc_signal<BusAssembly<4,5> > data1; sc_signal<BusAssembly<8,1,2> > data2; sc_clock clk("clk",10,SC_NS,true); data1.write(a); cout << "data1 " << data1 << "\n"; data1.dump(); data2.write(c); cout << "data2 " << data2 << "\n"; data2.dump(); sc_start(20,SC_NS); data1 = b; cout << "data1 " << data1 << "\n"; data1.dump(); data2 = d; cout << "data2 " << data2 << "\n"; data2.dump(); sc_start(20,SC_NS); data1.dump(); data2.dump(); return EXIT_SUCCESS; } And the Class definition one "frames.h" : #include <exception> #include "systemc.h" #include <stdio.h> template <int W=8, unsigned short Dim0=1, unsigned short Dim1=1> class BusAssembly { private: static const unsigned short dim = Dim0; public: sc_uint<W> value[Dim0][Dim1]; BusAssembly() { for (unsigned short i=0; i<Dim0; i++) for (unsigned short j=0; j<Dim1; j++) value[i][j] = 1; } BusAssembly(const sc_uint<W> t[][Dim1]) { for (unsigned short i=0; i<Dim0; i++) for (unsigned short j=0; j<Dim1; j++) value[i][j] = t[i][j]; } // Assignment operator BusAssembly& operator = (const BusAssembly& v) { if (this == &v) return *this; if (dim == v.dim) { for (unsigned short i=0; i<Dim0; i++) for (unsigned short j=0; j<Dim1; j++) value[i][j] = v.value[i][j]; // cout << *this << "\n"; return *this; } else throw "Assignment Error: Dimensions must match!"; } bool operator == (const BusAssembly& v) const { bool end = true; if (dim == v.dim) { for (unsigned short i=0; i<Dim0 && end; i++) for (unsigned short j=0; j<Dim1 && end; j++) end = (value[i][j] != v.value[i][j]); return end; } else throw "Assignment Error: Dimensions must match!"; } inline friend void sc_trace (sc_trace_file *tf, const BusAssembly& v, const std::string& NAME) { // sc_trace(tf,v.dim, NAME + ".dim"); for (unsigned short i=0; i<Dim0; i++) for (unsigned short j=0; j<Dim1; j++) { std::stringstream str; str << NAME << ".value(" << i << ")(" << j << ")"; sc_trace(tf,v.value[i][j],str.str()); } } inline friend ostream& operator << (ostream& os, const BusAssembly& v) { os << "(" << v.dim ; for (unsigned short i=0; i<Dim0; i++) for (unsigned short j=0; j<Dim1; j++) os << "," << v.value[i][j]; os << ")"; return os; } };
×
×
  • Create New...