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