meera Posted February 28, 2016 Report Share Posted February 28, 2016 hi, when i try to assign a particular bti in a vector by using the statement ff=o..it is showing error. Could any one pls tell what the mistake is. ..... sc_signal<sc_bv<8> > ff; void func(){ sc_int<size> i; if(rst){ for(i=0;i<10;i++) ff=0;//error } ...... Quote Link to comment Share on other sites More sharing options...
kartikkg Posted February 29, 2016 Report Share Posted February 29, 2016 Can you post the error message ? A cursory glance at the code reveals you trying to access an out-of-bonds bit. ff is 8-bit wide and the for loop goes beyond that. Quote Link to comment Share on other sites More sharing options...
meera Posted March 1, 2016 Author Report Share Posted March 1, 2016 hi, i was able to overcome the error, since iam new to systemc i didn't know that i had to include: #include "vector" as the header . Quote Link to comment Share on other sites More sharing options...
meera Posted March 1, 2016 Author Report Share Posted March 1, 2016 #include "systemc.h" #include "vector" SC_MODULE(w1){ sc_in<bool> on; void work(){ sc_bv<8> ff[10]; int i; if(on){ for (i=0;i<10;++i) { ff=0; cout<<"ff["<<i<<"]"<<ff<<endl; } } } SC_CTOR(w1){ SC_METHOD(work); sensitive<<on; } }; hi could anyone tell me why iam not getting :- ff=00000000 for all i Quote Link to comment Share on other sites More sharing options...
apfitch Posted March 1, 2016 Report Share Posted March 1, 2016 Should your code be cout<<"ff["<<i<<"]"<<ff[i] <<endl; ? Alan Quote Link to comment Share on other sites More sharing options...
meera Posted March 2, 2016 Author Report Share Posted March 2, 2016 well , i just wanted to see the values of ff after running the program. Quote Link to comment Share on other sites More sharing options...
meera Posted March 3, 2016 Author Report Share Posted March 3, 2016 iam getting error upon using "wait_until" #include "systemc.h" SC_MODULE (counter2) { sc_in_clk clock ; sc_in<bool> reset ; sc_in<bool> enable; sc_out<sc_uint<4> > counter_out; sc_uint<4> count; void incr_count () { while (true) { wait(10); WAIT_UNTIL(reset.delayed() == true || enable.delayed() == true); ERROR!! if (reset.read() == 1) { count = 0; counter_out.write(count); } else if (enable.read() == 1) { count = count + 1; counter_out.write(count); } } } void print_count () { while (true) { wait(); cout<<"@" << sc_time_stamp() << " :: Counter Value "<<counter_out.read()<<endl; } } SC_CTOR(counter2) { SC_CTHREAD(incr_count, clock.pos()); SC_THREAD(print_count); sensitive << counter_out; } }; // End of Module counter the error is Error 2 error C2039: 'delayed' : is not a member of 'sc_core::sc_in<bool> Quote Link to comment Share on other sites More sharing options...
apfitch Posted March 3, 2016 Report Share Posted March 3, 2016 wait_until and the delayed() method were removed from SystemC during standardisation. The best option is to use a do...while e.g. do { wait(); } while (reset.read() == false && enable.read() == false); regards Alan Quote Link to comment Share on other sites More sharing options...
meera Posted March 8, 2016 Author Report Share Posted March 8, 2016 hi, when i use switch statement,is it possible to transfer control from one case to another case? #include "systemc.h" enum htrans_type { IDLE, BUSY,NONSEQ,SEQ}; SC_MODULE(trans){ sc_in<htrans_type> HTRANS; void p1(){ while(true) { wait(); switch(HTRANS){ ///////////////////////////// case IDLE: { ................... ................................. ....................... } case NONSEQ:{....} .... ... now if i want to go in between from one switch case to other( say previous) what should i do? 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.