Skip to main content

Product Engineer II at Cadence Design Systems

Hello Dear Readers, Cadence Design Systems has a vacancy for a Product Engineer II role. Cadence is a pivotal leader in electronic design, building upon more than 30 years of computational software expertise. The company applies its underlying Intelligent System Design strategy to deliver software, hardware and IP that turn design concepts into reality.  Cadence customers are the world’s most innovative companies, delivering extraordinary electronic products from chips to boards to systems for the most dynamic market applications including consumer, hyperscale computing, 5G communications, automotive, aerospace industrial and health. The Cadence Advantage: The opportunity to work on cutting-edge technology in an environment that encourages you to be creative, innovative, and to make an impact. Cadence’s employee-friendly policies focus on the physical and mental well-being of employees, career development, providing opportunities for learning, and celebrating success in recog...

Modelling of Binary Encoding, Gray Encoding and One-hot encoding FSM using Verilog HDL

Hello Dear Readers, 

Today, I will explain how binary, gray, one-hot encoding FSM design using Verilog HDL.

1). Binary Encoding:

Binary encoding style can be used if the area requirement is a constraint on the design. In this encoding style state parameters for the binary encoding are represented in the binary format.

Two-Bit Binary Up-Counter FSM:

Two-bit binary counter FSM is described below, the number of states is equal to 4 and it needs four state variables ‘s0,’ ‘s1,’ ‘s2,’ and ‘s3.’ The number of flip-flops used to represent the functionality of the counter is equal to 2. The state transition table and the state transition diagram is shown in Fig.1 and Fig.2. The transition from one state to another state occurs on the positive edge of the clock. The default state is ‘s0’ and it is the reset state. So outcome is Moore machine as the output is a function of the current state only.

Fig.1 State Transition Table

Fig.2 State Diagram

Verilog Code:

module binary_count(clk,rst,y_out);

input clk,rst;

output reg [1:0]y_out;

parameter s0=2'b00,s1=2'b01,s2=2'b10,s3=2'b11;

reg [1:0]current_state,next_state;

// state logic definition

always @(posedge clk or negedge rst)

begin

  if(~rst)

     current_state<=s0;

  else

     current_state<=next_state;

end

// next state logic definition

always @(current_state)

case (current_state)

s0:next_state=s1;

s1:next_state=s2;

s2:next_state=s3;

s3:next_state=s0;        

default: next_state=s0;

endcase


//output logic definition

always @(current_state)

case(current_state)

s0:y_out=2'b00;

s1:y_out=2'b01;

s2:y_out=2'b10;

s3:y_out=2'b11;

default: y_out=2'b00;

endcase

endmodule

Simulational Results:

Fig.3 

2). Gray Encoding:

The Gray encoding style can be used if the area requirement is a constraint on the design. In this encoding style, state parameters are represented in the Gray format. 

Two-Bit Gray Counter FSM:

Two-bit Gray counter FSM is described below, the number of states is equal to 4 and it needs four state variables ‘s0,’ ‘s1,’ ‘s2,’ and ‘s3.’ The number of flip-flops used to represent the functionality of the counter is equal to 2. The state transition table and the state transition diagram is shown in Fig.4 and Fig.5. The transition from one state to another state occurs on the positive edge of the clock. The default state is ‘s0’ and it is the reset state. So the outcome is Moore machine as the output is a function of the current state only.

Fig.4 Gray Up-Counter State Table

Fig.5 State Diagram

Verilog Code:

module gray_count(clk,rst,y_out);

input clk,rst;

output reg [1:0]y_out;

parameter s0=2'b00,s1=2'b01,s2=2'b10,s3=2'b11;

reg [1:0]current_state,next_state;

// state logic definition

always @(posedge clk or negedge rst)

begin

  if(~rst)

     current_state<=s0;

  else

     current_state<=next_state;

end

// next state logic definition

always @(current_state)

case (current_state)

s0:next_state=s1;

s1:next_state=s3;

s3:next_state=s2;

s2:next_state=s0;        

default: next_state=s0;

endcase


//output logic definition

always @(current_state)

case(current_state)

s0:y_out=2'b00;

s1:y_out=2'b01;

s3:y_out=2'b11;

s2:y_out=2'b10;

default: y_out=2'b00;

endcase

endmodule

Simulational Results:

Fig.5 

3). One-Hot Encoding:
Two-bit Gray counter FSM is described below, the number of states is equal to 4 and it needs four state variables ‘s0,’ ‘s1,’ ‘s2,’ and ‘s3.’ The number of flip-flops used to represent the functionality of the counter is equal to 4. The state transition table is shown in Fig.6. The transition from one state to another state occurs on the positive edge of the clock. The default state is ‘s0’ and it is the reset state. So the outcome is Moore machine as the output is a function of the current state only.

Fig.6 State table for One-Hot Encoding FSM

Verilog Code:

module onehot_count(clk,rst,y_out);

input clk,rst;

output reg [1:0]y_out;

parameter s0=4'b0001,s1=4'b0010,s2=4'b0100,s3=4'b1000;

reg [3:0]current_state,next_state;

// state logic definition

always @(posedge clk or negedge rst)

begin

  if(~rst)

     current_state<=s0;

  else

     current_state<=next_state;

end

// next state logic definition

always @(current_state)

case (current_state)

s0:next_state=s1;

s1:next_state=s2;

s2:next_state=s3;

s3:next_state=s0;        

default: next_state=s0;

endcase


//output logic definition

always @(current_state)

case(current_state)

s0:y_out=2'b00;

s1:y_out=2'b01;

s3:y_out=2'b11;

s2:y_out=2'b10;

default: y_out=2'b00;

endcase

endmodule

Simulational Results:

Fig.7 






Comments

  1. Now clear doubts regarding modelling of one hot encoding FSM.

    ReplyDelete
  2. perfectly as expected

    ReplyDelete
  3. One of the favourite blog for the students who are doing mini projects.

    ReplyDelete
  4. Such a fabulous work you are doing. Keep posting such kind of tutorial articles so we may be feel confidential on us.

    ReplyDelete
  5. So now one hot FSM modelling doubts cleared thanks for this post.

    ReplyDelete
  6. What a contents, in specifically VlSI field we never expect in free of cost this level of blogs thanks for your entire effort and I see inside you another Sandeep Maheshwari of VLSI field educator. Keep it up

    ReplyDelete

Post a Comment

Popular posts from this blog

SDC (Synopsys Design Constraints) contents part 4

Today, we will be discussing the remaining constraints mentioned in the SDC, which pertain to timing exceptions and design rules. This is the final part of the SDC contents. This is going to be interesting, especially with multicycle paths. Take time to read and try to comprehend. 10. set_max_transition     By setting max transition value, our design checks that all ports and pins are meeting the specified limits mentioned in SDC. If these are not satisfied then timing report will give DRVs (design rule violations) in terms of slack. This is specified as               set_max_transition 0.5  UBUF1/A setting maximum limit of 500ps on pin A of Buffer1. 11. set_max_capacitance     This is same as max transition, setting the maximum capacitance value. if our design not meeting this value then violation will occur. This will also reports under design rule violations in terms of slack.     set_max_capacitance 0.7 [all_...

Apprenticeship CAI at MediaTek Bangalore

Hello Dear Readers,   Currently at MediaTek Bangalore vacancy for an Apprenticeship CAI role. Job Description: B.Tech degree in Electrical/Electronics Engineering with a strong educational background in Digital circuit design Experience in physical design of high performance design with frequencies > 2 Ghz. Experienced in hierarchical design, budgeting, multiple voltage domains and multiple clock domains. Strong skills with Cadence Encounter. Solid understanding of STA and timing constraints. Experienced in working on advanced process nodes (16nm). Strong expertise in Physical Verification to debug LVS/DRC issues at the block level. Requirement: B.Tech degree in Electrical/Electronics Engineering with strong educational background in Digital circuit design Experience in physical design of high performance design with frequencies > 2 Ghz. Experienced in hierarchical design, budgeting, multiple voltage domains and multiple clock domains. Strong skills with Cadence Enc...

IC Physical Design (PnR) at Ulkasemi

Hello Dear Readers,   Ulkasemi  has a vacancy for an IC Physical Design (PnR) role. Job Overview: As a full-time Trainee Engineer, the individual will be working on IC Physical Design implementation from RTL to GDSII to create design databases ready for manufacturing with a special focus on power, performance & area optimization with next-generation state-of-the-art process technologies. Job Responsibilities: Perform physical design implementation which includes Floor planning, Power Planning, Clock Tree Synthesis, Place and Route, ECO, Logic Equivalence checks Timing analysis, physical & electrical verification, driving the sign-off closure meeting schedule, and design goals Develop flow, methodologies, and automation scripts for various implementation steps Follow the instructions, compile documents, prepare deliverables, and report to the team lead Should remain up to date with the latest technology trends Educational Qualification:   B.Sc/M.Sc   in EEE or...