Jump to content

switch case


meera

Recommended Posts

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?

Link to post
Share on other sites
  • 2 weeks later...

 

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?
 
 
 
Hello Sir,
Please note that SystemC is a C/C++ library, so if the root language supports
switch - case statements, so will the library.  Hope that helps.

 

Link to post
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...