Jump to content

Search the Community

Showing results for tags 'matrix comparaison'.



More search options

  • 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 Synthesizable Subset v1.4 Public Review
    • SystemC Verification (UVM-SystemC, SCV)
  • UVM (Universal Verification Methodology)
    • UVM 1.2 Public Review
    • Methodology and BCL Forum
    • UVM SystemVerilog Discussions
    • Simulator Specific Issues
    • UVM Commercial Announcements
  • Portable Stimulus
    • Portable Stimulus Discussion
  • IP-XACT
    • IP-XACT Discussion
  • IEEE 1735/IP Encryption
    • IEEE 1735/IP Encryption Discussion
  • OCP (Open Core Protocol)
  • UCIS (Unified Coverage Interoperability Standard)
  • Commercial Announcements
    • Announcements

Categories

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

Calendars

  • Community Calendar

Found 1 result

  1. my first program systemC

    hi all, i write in this forum asking for help to solve this problem that tooks a lot of my time,iwrite my first program using systemC, my program debug but run exception i will expain my aim as much as i can , i stored 2 matrix of pixel value of image in two dfferent text file, i write a systemC code that load two matrix and comapre them, if number of different superior of a Threshold the code dispalays message (motion) my code composed of two modules, the first module check if there a number in a text file, if yes this Module will automates the other module to load the two matrix and compare them, i really need this code for my project graduation any help or sugesstion, sorry for my bad english. thank you // All systemc modules should include systemc.h header file #include "systemc.h" #include "stdio.h" #define _CRT_SECURE_NO_WARNINGS SC_MODULE(synchronous) { sc_out<bool> in; SC_CTOR(synchronous) {} void verify() { FILE *ifp, *ofp; char *mode = "r"; char outputFilename[] = "F:/yosri.txt"; int val; ifp = fopen(outputFilename, mode); while (fscanf_s(ifp, "%d", &val) != 1) { cout << " Waiting for request..."; } in = true; } }; SC_MODULE(imageProcess) { sc_in<bool> in; SC_CTOR(imageProcess) { SC_METHOD(MotionDetection); sensitive<<in; } void MotionDetection() { int Threshold = 20; bool fileFound; char *mode1 = "r"; char *mode2 = "w"; FILE *ofp1 = fopen("F:/image1.txt", mode1); FILE *ofp2 = fopen("F:/images2.txt", mode1); FILE *Motion = fopen("F:/image3.txt", mode2); int rowCounter, colCounter, isEqual = 0; int firstMatrix[384][512], secondMatrix[384][512]; // if (!(ofp1 || ofp2)) //{ //printf("2222222222222222222"); //fileFound = false; //} //else fileFound = true; //if (fileFound) { while (!feof(ofp1) && !feof(ofp2)) { for (rowCounter = 0; rowCounter < 384; rowCounter++) { for (colCounter = 0; colCounter < 512; colCounter++) { scanf("%d", &firstMatrix[rowCounter][colCounter]); } } for (rowCounter = 0; rowCounter < 384; rowCounter++) { for (colCounter = 0; colCounter < 512; colCounter++) { scanf("%d", &secondMatrix[rowCounter][colCounter]); if (firstMatrix[rowCounter][colCounter] != secondMatrix[rowCounter][colCounter]) { isEqual++; break; } } } if (isEqual > Threshold) { fputc(secondMatrix[rowCounter][colCounter], Motion); } else cout<< "MOTION"; } cout << "%d", isEqual; } }; // sc_main in top level function like in C++ main int sc_main(int argc, char* argv[]) { sc_start(); synchronous yosri("A"); yosri.verify(); imageProcess go("B"); go.MotionDetection(); return(0); } Quote Edit
×