Jump to content
Sign in to follow this  
meera

switch case

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?

Share this post


Link to post
Share on other sites

 

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.

 

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  

×