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

Finite State Machine (FSM) Modelling Using Verilog HDL

Hello Dear Readers,

Today, I will explain how Finite State Machine (FSM) is modeling using Verilog HDL.

The finite state machine (FSM) is a very important design block in the ASIC design. Most of the ASIC designs and controller design needs efficient and synthesizable state machines and are commonly called FSM. The FSMs can be described very efficiently by using the Verilog HDL and for ASIC design engineers.

Basically, FSMs are predefined sequences on the preordered or defined events and are source synchronous designs. FSMs can be coded efficiently for the synthesizable outcome using the multiple- or single-procedural block. In the practical scenario, it is recommended to use the multiple-procedural blocks to describe the state machines. One of the procedural blocks can describe the combinational logic and level-sensitive to the inputs or the states. Whereas, the other procedural block can be edge sensitive to the positive edge of the clock or to the negative edge of the clock.

1). State machine types:

i). Moore -vs- Mealy:

A Moore state machine is classified as an FSM where the outputs are only a function of the present state, while Mealy state machines have one or more outputs that are a function of the present state and one or more FSM inputs.

Fig.1 - Moore & Mealy State Machine block diagram

Moore state machines are favored in industry because the outputs have a full cycle to settle through the combinatorial logic and are therefore easier to meet required cycle times. Mealy outputs allow an input to appear after the cycle has started, and the input must still traverse the combinatorial logic and meet setup time for the Mealy output. If the design absolutely requires an input to make it on‐ chip after the active clock edge, pass through logic and appear on the output all within one cycle, those are the designs that typically use a Mealy output.

The timing analysis for the Moore machine is very simple due to clean register-to-register path but for the Mealy machine there might be chances of timing violations if the input changes during the setup time window. But the disadvantage of the Moore machine is it needs more states compared to the Mealy machine. The practical scenario is that the Mealy machine has one state less compared to the Moore machine.

ii). Binary -vs- OneHot encoding:

The second major classification is whether the state encoding of the FSM designs are binary (also referred to as highly encoded) or if they are OneHot. There are multiple binary encoded styles but what they have in common is that they typically use fewer flip‐flops to create unique binary encodings for each state in the FSM design than OneHot FSM designs. OneHot encoding uses one flip‐flop for each state in the state machine and when the state machine is in that state, that flip‐flop is "hot" or equal to "1" while the rest of the states are equal to "0." Since transitioning from one state to another only requires that the previous hot flip‐flop be set to 0 and the new hot flip‐flop be set to 1, the combinatorial logic to transition between states is typically very simple. OneHot FSM designs are typically inferred automatically by FPGA synthesis tools.

Fig.2 Binary -vs- OneHot state diagrams

2). FSM Encoding Styles:
FSM can be described by many styles and practically there are three encoding styles used to describe the FSMs. These styles are named as

i). Binary Encoding:  

g FSM can be described by using binary encoding styles and by using this style, the number of register elements used is equal to the log(number of states) 2 base. Consider an FSM has four states; then, the number of registers equal to log4(base 2) is equal to 2.

ii). Gray Encoding: 

FSM can be efficiently described by using the Gray encoding technique and in this style, the gray codes are used to represent the states. The number of register elements used is equal to log( number of states) 2 base. Consider an FSM has four states; then, the number of registers equal to log4(base 2) is equal to 2.

iii). One-hot Encoding: 

g FSMs can be efficiently described using a one-hot encoding style. One-hot indicates that only one bit is active high at a time or hot at a time. The number of register elements used is equal to the number of states in the FSM. Consider an FSM has four states than the number of registers also equals 4. This style requires more area but the advantage is it has a clean register-to-register path and it makes STA very simple. If FSM has 16 states then one-hot encoding needs 16 flip-flops. So let's start modeling FSM of level to pulse converter.

The level to pulse converter partial state transition diagram is shown in Fig.3. As shown in the diagram the FSM remains in the state ‘S0’ for the input data_in=0 and for the data input data_in=1, it remains in the state ‘S1.’ The state transition table for the Mealy level to pulse converter is shown in Fig.4.

Fig.3 http://courses.csail.mit.edu/

Fig.4 http://courses.csail.mit.edu/

3). Verilog Code:

module levelTopulse(data_in,clk,rst,y_out);
input data_in,clk,rst;
output reg y_out;
parameter s0=0,s1=1;
reg 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 @(data_in or current_state)
begin
case (current_state)
s0:begin if(data_in) next_state=s1;
         else next_state=s0;
end
s1:begin if(data_in) next_state=s1;
         else next_state=s0;
end
default: next_state=s0;
endcase
end
//output logic definition
always @(current_state,data_in)
begin
case(current_state)
s0:begin if(data_in) y_out=1'b1;
         else y_out=1'b0;
end
s1:y_out=1'b0;
default: y_out=1'b0;
endcase
end
endmodule

4). Simulational Results:



5). Layout of FSM:
Here RTL to GDSII flow is implemented in Qflow using OSU180nm technology node shown in Fig.5.

Fig.5  Final Layout of Level to Pulse converter









Comments

  1. Superb post now I got verilog code understanding of level to pulse conversion.

    ReplyDelete
  2. What a contents I hope your blog achieve sky keep it up. I regularly read your every post.

    ReplyDelete
  3. Thanks for posting I have try level to pulse state diagram but now my doubts solve.

    ReplyDelete
  4. Extremely useful Post, solved my miniproject doubts.

    ReplyDelete
  5. Really interesting way of your explanation and most important code is given to us free.

    ReplyDelete
  6. nice article ...
    https://www.vigyankiduniya.com/
    please support us also

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