wasim6691 Posted February 21, 2018 Report Share Posted February 21, 2018 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 : Quote Link to comment Share on other sites More sharing options...
maehne Posted February 21, 2018 Report Share Posted February 21, 2018 Your description and code snippet does not provide enough context for an external person to understand your intent. Please, provide more context and possibly a sketch of you system architecture so that the code snippet can be correctly interpreted. What do you mean by "to change the values of my ports"? If each layer differs from the previous, what is a point to use a loop instead of a simple to understand sequence of statements? Do you really need to expose the reader to so much details (i.e. 26 layers) to describe your problem? Try to reduce your example and enhance it with enough context so that we get a better idea of what you want to achieve. You seem to be not yet enough familiar with the fundamental concepts of SystemC. Consider to read a good introductory book to SystemC! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.