.ModuleBCD_to_Excess_3(data_ou,tdata_in,clk,reset)..outputdata_ou;t..inputdata_in,clk,rese;t..parameterS0=3b`000,S1=3b`001,S2=3b`101,S3=3b`111,S4=3b`011,S5=3b`110,S6=3b`010,..dont_care_case=3b`x,dont_care_out=1b`x;..reg[2:0]state,next_state;..regdata_ou;t..always@(posedgeclkornegedgereset)..if(reset==0)state=s0;..elsestate=next_state;..always@(stateordata_in)..begin..data_out=0;..case(state)..S0:if(data_in==0)..beginnext_state=s1;data_out=1;end..elseif(data_in==1)..beginnext_state=S2;end..S1:if(data_in==0)..beginnext_state=S3;data_out=1;end..elseif(data_in==1)..beginnext_state=S4;end..S2:beginnext_state=S4;data_out=data_in;end..S3:beginnext_state=S5;data_out=data_in;end..S4:if(data_in==0)..beginnext_state=S5;data_out=1;end..elseif(data_in==1)..beginnext_state=S6;end..S5:beginnext_state=S0;data_out=data_in;end..S6:beginnext_state=S0;data_out=data_in;end..defaul:t..beginnext_state=dont_care_case;..data_out=dont_care_ou;tend..endcase..end..endmodule