Jump to content
Sign in to follow this  
meera

vector declaration

Recommended Posts

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
  }     ......

Share this post


Link to post
Share on other sites
#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

Share this post


Link to post
Share on other sites
 

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>

 

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×