Jump to content

meera

Members
  • Content count

    24
  • Joined

  • Last visited

  1. thread

    hi, In systemc is in possible to invoke the same function using multiple threads ? like in c++: std::thread th1 (print_block,50,); std::thread th2 (print_block,50,);
  2. switch case

    hi, Since iam new to systemc and am trying out new things in order to learn , iam getting lot of doubts, hope someone can help me out!! like i verilog where we use case statement for implementing fsm,similarly in systemc to implement some fsm i hope we use switch statement, so is it possible to switch from one case to another? if so how is it done? This is part of the code i wanted to realize: #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: {///* I have some conditions here } break; case IDLE: {/// * some conditions} break; case BUSY:{//// *some condition) break; } how do i switch case from one case to other?
  3. vector declaration

    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?
  4. vector declaration

    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>
  5. vector declaration

    well , i just wanted to see the values of ff after running the program.
  6. vector declaration

    #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
  7. vector declaration

    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 .
  8. vector declaration

    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 } ......
  9. vector declaration

    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 } ......
  10. adder - hierarchy- output issue

    Hi Alan, is there any other keyword instead of sensitive? which could be used, to achieve the desired output . thanks
  11. Hi, i was trying to obtain a fulladder through half adder. i was able to build and run the program but i find that outputs are not as expected. i feel it must be something to do with sensitivity. could anyone pls suggest that the mistake is. full_adder.h #include "half_adder.h" SC_MODULE (full_adder) { sc_in<bool>a,b ,cin; sc_out<bool>sum,carry; sc_signal<bool> c1,c2,s1; void disp() { cout<<"a="<<a<<endl; cout<<"b="<<b<<endl; cout<<"cin="<<cin<<endl; cout<<"sum="<<sum<<endl; cout<<"carry="<<carry<<endl; cout<<endl; } void or() { carry= c1|c2; } half_adder *halfl_adder1_ptr , *halfl_adder2_ptr; SC_CTOR(full_adder){ halfl_adder1_ptr= new and("half_adder1"); halfl_adder1_ptr->a(a); halfl_adder1_ptr->b(; halfl_adder1_ptr->sum(s1); halfl_adder1_ptr->carry(c1); halfl_adder2_ptr= new and("half_adder2"); halfl_adder2_ptr->a(s1); halfl_adder2_ptr->b(cin); halfl_adder2_ptr->sum(sum); halfl_adder2_ptr->carry(c2); SC_METHOD(or); sensitive <<c2<<c1; SC_METHOD(disp); sensitive <<sum<<carry; } ~full_adder(){ delete halfl_adder1_ptr; delete halfl_adder2_ptr; } };
  12. binding issue

    Hi Alan, Now iam able to see the correct output. Thanks for helping me out with the issues. thank you Meera
  13. binding issue

    sorry yes u r correct. but if you could execute the lines in my recent post probably you might understand what iam trying to say.
  14. binding issue

    hi, if u execute is u will get to know what iam trying to say as .cpp #include "systemc.h" #include "and.h" int sc_main(int argc, char* argv[]) { sc_signal<sc_uint <3> > a ; sc_signal<sc_uint <3> > b ; sc_signal<sc_uint <3> > s ; and d1("And"); d1.a(a); d1.b( ; d1.s(s); a=3; b=4; sc_start(20,SC_NS); a = 1; b = 2; sc_start(20,SC_NS); a = 3; b = 4; sc_start(20, SC_NS); a = 4; b = 2; sc_start(20, SC_NS); a = 1; b = 1; sc_start(20, SC_NS); return 0; }
  15. binding issue

    Hi, i did try doing that , but as i pointed out i feel result of "s" is seen only in the next cycle...what should i do for that?
×