Jump to content

wasim6691

Members
  • Content Count

    35
  • Joined

  • Last visited

Posts posted by wasim6691


  1. I mean for Example I have two Modules A and  B. Once I use sc_start() command. Simulation runs only once and thread dies. But I want to keep the simulation run x times before getting the thread dead. Thats why In the Top module I am trying something to solve this. If You understand my question then let me know.Please or I should elaborate more. Thanks


  2. I am running this loop in the constructor of the top module but I as the values i want to vary for the re-run of the simulation. How to restart the simulation with new set of values. I have instantiated this top module in the main and calling sc_start() command from there. help me Thanks


  3. Hi 

    I am defining the input ports at the top module which will be the input ports also to all the sub-modules. But these input ports have to change the value as I have to run the for loop for multiple layers. Where exactly I have to run this for loop in the TOP MODULE. Whether i have to a make a process inside the top Module but then I will not be able to change the values of my ports. Thanks. The loop is given as:

    for (int layer_id = 0; layer_id < 27; layer_id++)
    	{
    
    		net_CFG = get_network_config();
    
    		layer_t  layer = net_CFG->layers[layer_id];
    		dimension_t    w_in = layer.width;           // 256 First Layer
    		dimension_t    h_in = layer.height;          // 256
    		channel_t      chi = layer.channels_in;      // 3
    		channel_t      cho = layer.channels_out;     // 64
    		stride_t         s = layer.stride;           // 2
    		kernel_t         k = layer.kernel;
    
    
    		width.write(w_in);
    		height.write(h_in);
    		chin.write(chi);
    		chout.write(cho);
    		stride.write(s);
    		kernel_value.write(k);
    
    
    	}

     


  4. Hi 

    I am defining the input ports at the top module which will be the input ports also to all the sub-modules. But these input ports have to change the value as I have to run the for loop for multiple layers. Where exactly I have to run this for loop in the TOP MODULE. Whether i have to a make a process inside the top Module but then I will not be able to change the values of my ports. Thanks. The loop is given as:

    //for (int a = 0; a < num_layers - 26; a++){  // Only for First Layer
    		//	switch (a){
    		//	case 0:
    		//		width = 256;
    		//		height = 256;
    		//		chin = 3;
    		//		chout = 64;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout; // 1792
    		//		// First Layer Weight Values = 1792 - 64 = 1728
                                    
                              sc_in<sc_uint<10>> width_in;
                              sc_in<sc_uint<10>> height_in;
                              sc_in<sc_uint<10>> chin_in;
                              sc_in<sc_uint<10>> chout_in;
                              sc_in<sc_uint<10>> kerenl_in;
      
    		//		break;
    		//	case 1:
    		//		width = 128;
    		//		height = 128;
    		//		chin = 64;
    		//		chout = 16;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin* kernel_1 * kernel_1 + chout; // 1792 + 9232 = 11024
      
                              sc_in<sc_uint<10>> width_in;
                              sc_in<sc_uint<10>> height_in;
                              sc_in<sc_uint<10>> chin_in;
                              sc_in<sc_uint<10>> chout_in;
                              sc_in<sc_uint<10>> kerenl_in;
    		//		break;
    		//	case 2:
    		//		width = 64;
    		//		height = 64;
    		//		chin = 16;
    		//		chout = 64;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout; // 11024 + 1088 = 12112
      
                              sc_in<sc_uint<10>> width_in;
                              sc_in<sc_uint<10>> height_in;
                              sc_in<sc_uint<10>> chin_in;
                              sc_in<sc_uint<10>> chout_in;
                              sc_in<sc_uint<10>> kerenl_in;
    		//		break;
    		//	case 3:
    		//		width = 64;
    		//		height = 64;
    		//		chin = 16;
    		//		chout = 64;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout; // 12112 + 9280 = 21392
                               sc_in<sc_uint<10>> width_in;
                              sc_in<sc_uint<10>> height_in;
                              sc_in<sc_uint<10>> chin_in;
                              sc_in<sc_uint<10>> chout_in;
                              sc_in<sc_uint<10>> kerenl_in;
    		//		
                         break;
    		//	case 4:
    		//		width = 64;
    		//		height = 64;
    		//		chin = 128;
    		//		chout = 16;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout; // 21392 + 2064 = 23456
    		//		
                             sc_in<sc_uint<10>> width_in;
                              sc_in<sc_uint<10>> height_in;
                              sc_in<sc_uint<10>> chin_in;
                              sc_in<sc_uint<10>> chout_in;
                              sc_in<sc_uint<10>> kerenl_in;
                            break;
    		//	case 5:
    		//		width = 64;
    		//		height = 64;
    		//		chin = 16;
    		//		chout = 64;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout; // 23456 + 1088 = 24544
    		//		break;
    		//	case 6:
    		//		width = 64;
    		//		height = 64;
    		//		chin = 16;
    		//		chout = 64;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout; // 24544 + 9280 = 33824
    		//		break;
    		//	case 7:
    		//		width = 64;
    		//		height = 64;
    		//		chin = 128;
    		//		chout = 32;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout; // 33824 + 36896 = 70720
    		//		break;
    		//	case 8:
    		//		width = 32;
    		//		height = 32;
    		//		chin = 32;
    		//		chout = 128;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout; // 70720 + 4224 = 74944
    		//		break;
    		//	case 9:
    		//		width = 32;
    		//		height = 32;
    		//		chin = 32;
    		//		chout = 128;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;//74944 + 36992 = 111936
    		//		break;
    		//	case 10:
    		//		width = 32;
    		//		height = 32;
    		//		chin = 256;
    		//		chout = 32;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin* kernel_1 * kernel_1 + chout;//111936 + 8224 = 120160
    		//		break;
    		//	case 11:
    		//		width = 32;
    		//		height = 32;
    		//		chin = 32;
    		//		chout = 128;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;//120160 + 4224 = 124384
    		//		break;
    		//	case 12:
    		//		width = 32;
    		//		height = 32;
    		//		chin = 32;
    		//		chout = 128;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;//124384 + 36992 = 161376
    		//		break;
    		//	case 13:
    		//		width = 32;
    		//		height = 32;
    		//		chin = 256;
    		//		chout = 64;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;//161376 + 147520 = 308896
    		//		break;
    		//	case 14:
    		//		width = 16;
    		//		height = 16;
    		//		chin = 64;
    		//		chout = 256;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;// 308896 +16640 = 325536
    		//		break;
    		//	case 15:
    		//		width = 16;
    		//		height = 16;
    		//		chin = 64;
    		//		chout = 256;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;// 325536 + 147712 = 473248
    		//		break;
    		//	case 16:
    		//		width = 16;
    		//		height = 16;
    		//		chin = 512;
    		//		chout = 64;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;// 473248 + 32832 = 506080
    		//		break;
    		//	case 17:
    		//		width = 16;
    		//		height = 16;
    		//		chin = 64;
    		//		chout = 192;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;// 506080 + 12480 = 518560
    		//		break;
    		//	case 18:
    		//		width = 16;
    		//		height = 16;
    		//		chin = 64;
    		//		chout = 192;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;// 518560 + 110784 = 629344
    		//		break;
    		//	case 19:
    		//		width = 16;
    		//		height = 16;
    		//		chin = 384;
    		//		chout = 112;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin* kernel_1 * kernel_1 + chout; //629344 + 387184 = 1016528
    		//		break;
    		//	case 20:
    		//		width = 8;
    		//		height = 8;
    		//		chin = 112;
    		//		chout = 256;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin* kernel_1 * kernel_1 + chout;//1016528 + 28928 = 1045456
    		//		break;
    		//	case 21:
    		//		width = 8;
    		//		height = 8;
    		//		chin = 112;
    		//		chout = 256;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin* kernel_1 * kernel_1 + chout;// 1045456 + 258304 = 1303760
    		//		break;
    		//	case 22:
    		//		width = 8;
    		//		height = 8;
    		//		chin = 512;
    		//		chout = 112;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;//1303760 + 57456 = 1361216
    		//		break;
    		//	case 23:
    		//		width = 8;
    		//		height = 8;
    		//		chin = 112;
    		//		chout = 368;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;// 1361216 + 41584 = 1402800
    		//		break;
    		//	case 24:
    		//		width = 8;
    		//		height = 8;
    		//		chin = 112;
    		//		chout = 368;
    		//		kernel_1 = 3;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout;// 1402800 + 371312 = 1774112
    		//		break;
    		//	case 25:
    		//		width = 8;
    		//		height = 8;
    		//		chin = 736;
    		//		chout = 512;
    		//		kernel_1 = 1;
    		//		num_weights = chout * chin * kernel_1 * kernel_1 + chout; // 1774112 + 377344 = 2151456
    		//		break;
    		//	case 26:
    		//		width = 8;
    		//		height = 8;
    		//		chin = 736;
    		//		chout = 512;
    				kernel_1 = 1;
    				num_weights = chout * chin * kernel_1 * kernel_1 + chout;// 2151456 + 377344 = 2528800
    				break;
    
    			default:
    
    				break;
    			}

     THE ABOVE SC_IN PORTS WILL BE DEFINED IN ALL THE CASES : 


  5. Hi Maehne

    I want to pass 16 vectors over these 16 ports.  Let's say  each vector A1[9], A2[9]............ A16[9] on each of these 16 ports. thanks. For one array value,  i can use x.write() or x.read commands. but I want to pass vectors on each of the ports. I can use pointers but If there is any other way to pass vectors through ports that would be so nice of you to guide me. thanks


  6. Hi David,

    I have to define 16 ports of sc_vector<sc_out<sc_uint<4>>>    some-vector ;    and pass the array elements in parallel through those 16 ports between the Modules. std::vector I do know but for my case I have to dedicate 16 ports at the MODULE A and 16 ports at the MODULE B to make the access of array elements in parallel. i am defining my vector as described in bold but need help how to pass array. Thanks


  7. Hi, 

    I want to run the diagram given below. I am executing the modules with the respective processes but it only execute once and then the loop dies. I am providing the static sensitivity to the processes inside the modules e.g.  sensitive<< sig1; and so on. How to make the execution multiple times as mentioned in the STEPS in the Diagram. I need help in running the STEPS multiple times before we proceed to the next step in System C code. Thanks

    SystemC Running in Loop.png


  8. Hi

    I am running the Sequence of Modules in the flow like: 

    1) Memory Module

     2) Data fetching to the Weight and Image_Cache  Modules

    3) Processing_PIXEL_MODULE  and so on. 

    But I wanted to go back from Processing_pixel_Module to the Image_Cache Module for Cache refill. Can You help me that how can I achieve this. I wanted to go back to the Image_Cache Module to refill the Cache from the Memory module. thanks. 


  9. Hi

    The TLM_READ_COMMAND IS NOT READING THE DATA ARRAY COMPLETELY. 

    What can be the possible reason. I have allocated an array through malloc command in the memory module. and Then from the second module i am trying to read that array using the TLM_READ_COMMAND but the array is not being read completely and it stops in the mid somewhere. Just not running any further without showing any error. What can be possible reason for this . Thanks


  10. Hi David 

    In the memory module if use Dynamic Allocation for the Array then TLM transfer from one Module to Another Works. Otherwise TLM transfer does not work if just define the array like   :  mem[ i ] = data;  where 0< i < 2528800. It may also cause stack overflow problem. Is dynamic Allocation for SHARED DRAM Memory ok ? Thanks.

    What Is meant by use MEMBER DATA for the memory ?


  11. Hi 

    I have to load a floating point data from the binary file and save it in an array inside the MODULE_1 (Memory) and then I wanted to transfer the content of that array from MODULE_1 to Another MODULE_2 (CACHE) through TLM. Can You guide me how to save an array in MODULE_1 (Memory) and transfer the floating point data to another MODULE_2 (Cache) through TLM.  I am trying to read the data from CACHE to MEMORY but TLM_GENERIC_PAYLOAD does not access the correct memory address of the array elements to read from and therefore I am just reading some garbage value. A help through sample code is much appreciated. Thanks


  12. //  MODULE 1  WRITING THE OUT1 to Value 1

    SC_MODULE(MODULE_1){

    public:
        //-------------PORTS DECLARATIONS---------------------------
                sc_in<bool> reset;
                sc_out<bool>  out1  ;  

         // ---event

         sc_event   sig_written;

         public:

          void Process();

    public:
        SC_CTOR(MODULE_1){

            SC_METHOD(Process);
            sensitive << reset;

    }  

    void Process() {

    if (reset == 1)

        out1.write(1);

         sig_written.notify();    // to make it runnable within the execution phase and not in the Next delta cycle

    }

    };

     

    //----------------------------------------------------------------------------------------------------------

    //  MODULE 2  READING OUTPUT VALUE FROM MODULE_1

    SC_MODULE(MODULE_2){

    public:
        //-------------PORTS DECLARATIONS---------------------------
                sc_in<bool>  input1;
                sc_out<bool>  out2  ;  

         public:

    // HOW TO DEFINE EVENT HERE ?

    // PROCESS

    void Process();

    public:
        SC_CTOR(MODULE_2){

            SC_METHOD(Process);
            sensitive << input1; 

    }  

    void Process() {

    bool x;

    x = input1.read();   // reading the Output Value from Module 1. I want to read here 1 because of output

    // written in the MODULE_1 is 1

    if (x == 1)

        out2.write(1);

       // HOW TO USE EVENT HERE ?   SHARED EVENT

    }

    };

    Hi  I am outputting One value from MODULE 1 and notifying it through sig_written.notify() event to make it detectable in the same execution phase and not in the next delta cycle. Can You tell me How to use the event in the MODULE_2 to detect this event and read the value immediately without going into next delta cycle. thanks  


  13. Hi

    1) my Development Environment is Windows with Visual Studio 2013 for Desktop

    2) In Visual Studio, You have the option in the Linker--- System--- Setting for Stack and Heap Size

    3) Yes, This is the only option to use Dynamically Allocated.

     

    But Can You suggest me some other option to get out of this Stack over flow Problem. ? Thanks. 

    RECURSION: By recursion I mean that If I am sending input from Module-1 to Module-2 and then I am expecting a result from Module-1 to Module-2 (Here in their processes I am using sig.value_changed_event())  and then after getting the result from Module-1, Module-2 send the input to Module-3. 


  14. Hi 

    I have 3 to 4 modules and they have 3 to 4 inputs but to synchronize the timing of inputs as they all have to have specific value only then my THREAD PROCESS should run, I am using value_changed_event inside the THREAD PROCESS of the MODULE by using wait(sig.value_changed_event()). But In some MODULES, I am initializing large arrays and due to this when the value changes then it rerun from the 1st Module to the Last and stops in the mid-way displaying the stack over flow as the exception. What Should be the possible solution for this ? I have Increase the Stack size upto  1Giga but still does not work. Thanks 


  15. Hi Maehne

    But If I am defining Memory as SC_MODULE and using 4KB Memory Alignment for my data storage as I am reading the data from binary files. As I have to read from and store the respective output data in the Memory Module. Like I am confused How do i define the Memory Module using static allocation. Can You give me or refer to some example. That would be so nice of You. Thanks


  16. Hi, 

    I have to Allocate Memory for my data in SystemC.

    We Use malloc in C Language and New in C++ to dynamically Allocate Memory. But today I have read that we cannot use New and Delete Operators in System C as they are not synthesizeable. Which command should I use for Memory Allocation in System C. Thanks.


  17. Hi, 

    We use SystemC to define specific Hardware Blocks like Memory, Caches and Bus etc. We define Header and CPP files and Include processes to define the functionalities being done by each module. BUT let's say Now we have to define the general settings of the Whole Network (like NEURAL NETWORKS AND DEEP LEARNING NETWORKS) which include Two or three STRUCTS about configuration and we make additional Header and CPP file for this. WILL THAT BE CONSIDER AS A FURTHER HARDWARE IN THE SYSTEM C Design. Is that allowed or not ? This is a general question? Please explain me this in detail? Thanks

×