meera Posted March 10, 2016 Report Share Posted March 10, 2016 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? Quote Link to comment Share on other sites More sharing options...
kartikkg Posted March 10, 2016 Report Share Posted March 10, 2016 Before the break statement you can change the state HTRANS = new_state. Quote Link to comment Share on other sites More sharing options...
dakupoto Posted March 23, 2016 Report Share Posted March 23, 2016 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.