Jump to content

vector declaration


meera

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
  }     ......
Link to comment
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
Link to comment
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>

 

Link to comment
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?

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...