-
Posts
613 -
Joined
-
Last visited
-
Days Won
121
apfitch last won the day on January 10
apfitch had the most liked content!
Profile Information
-
Gender
Not Telling
apfitch's Achievements
Advanced Member (2/2)
214
Reputation
-
Amit Bhandu started following apfitch
-
TommyWu reacted to a post in a topic: loosely timed vs accurate timed ??
-
TommyWu reacted to a post in a topic: loosely timed vs accurate timed ??
-
venkata ramana reacted to a post in a topic: Use event to communicate between modules
-
Kartik Podugu reacted to a post in a topic: temporal decoupling
-
Kartik Podugu reacted to a post in a topic: temporal decoupling
-
Amit Bhandu reacted to a post in a topic: Use cases of TLM over systemC
-
Nitin_S reacted to a post in a topic: benifits of sc_export over sc_port
-
ljepson74 reacted to a post in a topic: uvm_scoreboard requires analysis import to compile. why?
-
KiranK reacted to a post in a topic: Memory mapped bus ??
-
SiGa reacted to a post in a topic: user defined data type signal assignment
-
There's also a video library supplied with Xilinx HLS http://www.wiki.xilinx.com/HLS+Video+Library HLS supports SystemC as well as C++. regards Alan
-
Hi Yosri, I don't understand why you want to do this in SystemC, the algorithm you've written just reads from a file and writes to a file, which is well suited to a plain C or C++ program. Some specific comments - you have declared "sig" and haven't used it. In sc_main you've called the SC_METHOD using master.MotionDetector. You don't need to do that, the SC_METHOD is a parallel thread and will run automatically at time 0. However as I said above, my main comment is why are you using SystemC? Why not just write a plain C/C++ program? regards Alan
-
There's a complete example here: https://www.doulos.com/knowhow/systemc/faq/#q1 regards Alan P.S. Note it uses inline friends, which is perhaps a bit quirky.
-
Clocked thread SC_CTHREAD exclusion during initialization phase
apfitch replied to SystemCInDepth's topic in SystemC Language
Hi Mr SystemCInDepth, I think it's important to realise that SC_CTHREAD is special, in that the specified sensitivity is a clock (the rising or falling edge event of a bool or sc_logic). There's no such thing as a "clock" for SC_METHOD and SC_THREAD - just events on channels such as sc_signal, sc_fifo, or any other channel that implements an event. So I would not say because an SC_METHOD or an SC_THREAD does not have a clock. That's what Philipp meant when he said Does that make it clearer? regards Alan -
Is your sc_fifo a class member? Don't forget you must initialise class members on the constructor initialiser list (at least before c++ 11) regards Alan
-
If your goal is to synthesize the design, then your first step should be to check what is synthesisable - are you using a particular high level synthesis tool? Have you checked this it will support sc_fifo and sc_semaphore? If your tool supported std::map, couldn't you use use that? regards Alan
-
Difference between Master and Slave Agents
apfitch replied to Shankhadeep's topic in UVM SystemVerilog Discussions
Hi, in UVM people tend to talk about agents as being passive, active, or reactive instead of "master" or "slave". Each agent contains a driver, a monitor, and a sequencer. An active agent has all three. A passive agent monitors, but does not drive. A reactive agent drives, but depends on the DUT more closely (i.e. the agent drives data to the DUT, but reacts in some way with the DUT. So I guess you could be using "master" to mean active, and "slave" to mean reactive *or* passive. regards Alan -
You should be able to view the Call Stack in Visual C++ - that may give you an idea of exactly where the exception is being thrown, regards Alan
-
There's lots wrong with your code - did you look at the tutorial on www.doulos.com as someone suggested in the earlier thread? Any way, I've tried to add some comments in your code #include "systemc.h" #include "stdio.h" #include "string.h" #include "stdio.h" #include"stdlib.h" #define _CRT_SECURE_NO_WARNINGS sc_out<bool> in; // DON'T DECLARE A PORT OUTSIDE A MODULE SC_MODULE(synchronous) { bool synchronization() { sc_out<bool> in; // DON'T DECLARE A PORT INSIDE A FUNCTION FILE *workspace = fopen("F:/yosri.txt", "r"); char buff[13]; fgets(buff, 12, workspace); int ret = 0; while (ret == 0) { cout << "Waiting for request...\n"; ret = strcmp(buff, "SWITCHCONTEXT"); printf("%d", ret); } //SWITCHCONTXT is a string written in a text file in = true; cout << "Establishing communication"; return(in); // YOU CAN'T RETURN A PORT CLASS LIKE THIS } }; SC_MODULE(imageProcess) // WHY USE A MODULE HERE? I can't see what SystemC features you're using? { sc_in<bool> in; // WHAT'S THIS FOR? void MotionDetector(bool signal) { printf("\nCommuncation established"); char *mode1 = "r"; char *mode2 = "w"; int i, j, k; int C = 0; int rows1, cols1, rows2, cols2; bool fileFound = false; bool multiplcation = true; FILE *image1; FILE *image2; FILE *image3; int sum = 0; image3 = fopen("F:/image3.txt", mode2); do { char *mode1 = "r"; char *mode2 = "w"; image1 = fopen("F:/image1.txt", mode1); if (!image1) { printf("File Not Found!!\n"); fileFound = true; } else fileFound = false; } while (fileFound); do { image2 = fopen("F:/image2.txt", mode1); if (!image2) { cout << "File Not Found!!\n"; fileFound = true; } else fileFound = false; } while (fileFound); //allocate Matrcies rows1 = rows2 = 384; cols1 = cols2 = 512; int **mat1 = (int **)malloc(rows1 * sizeof(int*)); for (i = 0; i < rows1; i++) mat1 = (int *)malloc(cols1 * sizeof(int)); i = 0; int **mat2 = (int **)malloc(rows2 * sizeof(int*)); for (i = 0; i < rows2; i++) mat2 = (int *)malloc(cols2 * sizeof(int)); i = 0; while (!feof(image1)) { for (i = 0; i < rows1; i++) { for (j = 0; j < cols1; j++) fscanf(image1, "%d%", &mat1[j]); } } i = 0; j = 0; while (!feof(image2)) { for (i = 0; i < rows2; i++) { for (j = 0; j < cols2; j++) fscanf(image2, "%d%", &mat2[j]); } } i = 0; j = 0; printf("\n\n"); i = 0; k = 0; cout << "\n\n"; for (i = 0; i < rows1; i++) { for (j = 0; j < cols1; j++) { if (mat1[j] != mat2[j]) C++; } } i = j = 0; if (C > 20) { printf("MOTION...DETECTED\a \a"); for (i = 0; i < rows1; i++) { for (j = 0; j < cols1; j++) { fprintf(image3, "%d ", mat2[j]); } fprintf(image3, "\n"); } cout << "\n Image Saved...."; } fclose(image1); fclose(image2); fclose(image3); } }; // sc_main in top level function like in C++ main int sc_main(int argc, char* argv[]) { SC_CTOR(synchronous) // sc_main is not a class so you can't declare a constructor here. { SC_METHOD(synchronization); } SC_CTOR(imageProcess) // sc_main is not a class so you can't declare a constructor here. { SC_METHOD(MotionDetector); sensitive << in; } sc_start(); return(0); } Your code shows a lot of confusion between ports, modules, sc_main, and processes. I highly recommend going back to that tutorial and getting a very simple example running (perhaps an AND gate) and checking you understand that first, kind regards Alan
-
Generic payload and custom bytes/words
apfitch replied to Zdenek Prikryl's topic in SystemC TLM (Transaction-level Modeling)
Hi Zdenek, the template parameter to the various sockets represents the width of the bus, so you could change that to 12 from the default of 32. However the existing code does generally assume that 1 byte = 8 bits (e.g. the byte enables work with words split into 8 bit bytes). So you'd probably have to write some custom code, Alan- 2 replies
-
- tlm
- custom bytes
-
(and 1 more)
Tagged with:
-
Error:<E109> complete binding failed: port not bound:
apfitch replied to ehsanullah's topic in SystemC Language
Hi, the reason for the error is that you're not binding all your ports. You bind the ports in this loop: for(int i=0;i<n;i++) { for (int j=0;j<=i;j++) { std::cout << i << " " << j << " " << std::endl; test_CHOL0->chol_in_data[i][j](chol_in_data[i][j]); test_CHOL0->chol_out_data[i][j](chol_out_data[i][j]); } } but in the second loop you have j <= i. I've added printing and you can see that you only bind 6 of the 9 ports SystemC 2.3.1-Accellera --- Sep 3 2016 13:00:03 Copyright (c) 1996-2014 by all Contributors, ALL RIGHTS RESERVED 0 0 1 0 1 1 2 0 2 1 2 2 I think you need j < n regards Alan -
I guess first you'd need to add an attribute (extension) to the generic payload to represent the priority. Then you could write a variant of the PEQ which takes into account that priority. regards Alan
-
For that kind of modelling you probably need resolved types, e.g. sc_signal_resolved, sc_in/out resolved. These types model signal strength resolution, i.e. if you drive two values such as '1' and 'Z', '1' will be the resulting value because '1' is stronger than 'Z'. Have a look at the SystemC standard 1666-2011, especially section 6.13.5 where there's a little example that might help, regards Alan
-
Could you post your code? regards Alan