Search the Community
Showing results for tags 'range'.
-
Hi, I was trying to map port from a outer module to an input port of inner module. The ports to be mapped in a certain way that a range of input port of outer module is to be mapped with the input port of the inner module. Example is given below. inner module : SC_MODULE(alu) { sc_in<sc_uint<8> > a_in; sc_in<sc_uint<8> > b_in; sc_in<sc_bv<2> > op; sc_in<bool> en; sc_out<sc_uint<8> > out_sig; void calc_out(); SC_CTOR(alu){ cout<<"alu constructor"<<endl; SC_METHOD( calc_out ); sensitive<<op<<a_in<<b_in<<en; } }; Outer module: sc_in <sc_uint<24> > ins; sc_in <bool> coack; sc_in <bool> memack; sc_out <sc_uint<8> > out; sc_out <sc_uint<8> > memout; sc_out <sc_uint<23> > coprout; sc_out <bool>corqst; sc_out <bool> memrqst; sc_signal <bool> aluen ; //sc_signal <sc_bv<24> > ins_sig; sc_signal <sc_int<8> > result_sig; alu* alup; SC_CTOR(processor) { alup = new alu("alup"); alup->a_in(ins.range(15,8)); // HERE THE ERROR IS COMMING. I want to map a range of port bit of processor (outer // int i; // module) to the whole one port of alu (inner module) // alup->a_in[7](ins[15]); // for(i=15;i>=8;i--) // alup->a_in[i-8](ins); alup->b_in(ins_sig.range(7,0)); // SAME HERE // for(i=7;i>=0;i--) // alup->b_in(ins); alup->op(ins_sig.range(17,16)); //SAME HERE for(i=17;i>=16;i--) alup->op[i-16](ins); alup->en(aluen); alup->out_sig(result_sig); SC_THREAD(request_copr); sensitive << ins << coack.pos(); SC_THREAD(request_mem); sensitive << ins << memack.pos(); SC_METHOD(show_out); sensitive<<out_sig; } // functions.... } I will be highly thankful if anyone ca help me with this.