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

Restoring And Non Restoring Division Algorithms Using Verilog HDL

 Hello Dear Readers,

Today In this post I have implemented Restoring Division Algorithm Using Verilog HDL. So I have followed this One video from Tutorial Point Youtube Channel So go through it before Verilog code.

start means the start of the division; busy indicates that the divider is busy (cannot start a new division); ready indicates that the quotient and remainder are available, and the count is the output of a counter that is used to control the iterations of the division.

Verilog Code(Restoring):

module divider_32(a,b,start,clk,reset,q,r,busy,ready,count);
input [31:0] a; // dividend
input [15:0] b; // divisor
input start; // start
input clk,reset; // clk,reset
output [31:0] q; // quotient
output [15:0] r; // remainder
output reg busy; // busy
output reg ready; // ready
output [4:0] count; // counter
reg [31:0] reg_q;
reg [15:0] reg_r;
reg [15:0] reg_b;
reg [4:0] count;
wire [16:0] sub_out = {reg_r,reg_q[31]} - {1'b0,reg_b}; // sub
wire [15:0] mux_out = sub_out[16]? // restoring logic
{reg_r[14:0],reg_q[31]} : sub_out[15:0]; // or not
assign q = reg_q;
assign r = reg_r;
always @ (posedge clk or negedge reset) begin
if (!reset) begin
busy <= 0;
ready <= 0;
end else begin
if (start) begin
reg_q <= a; // load a
reg_b <= b; // load b
reg_r <= 0;
busy <= 1;
ready <= 0;
count <= 31;
end else if (busy) begin
reg_q <= {reg_q[30:0],~sub_out[16]}; // << 1
reg_r <= mux_out;
count <= count - 5'b1; // counter++
  if (count == 5'h0) begin // finished
    busy <= 0;
    ready <= 1; // q,r ready
      end
    end
  end
end
endmodule

Verilog Code(Non Restoring):

module nonrestore_32(a,b,start,clk,reset,q,r,busy,ready,count);
   input [31:0] a; // dividend
   input [15:0] b; // divisor
input start; // start
   input clk,reset; // clk,reset
   output [31:0] q; // quotient
   output [15:0] r; // remainder
   output reg busy; // busy
   output reg ready; // ready
   output [4:0] count; // count
   reg [31:0] reg_q;
   reg [15:0] reg_r;
   reg [15:0] reg_b;
   reg [4:0] count;
wire [16:0] sub_add = reg_r[15]?
{reg_r,reg_q[31]} + {1'b0,reg_b} : // + b
{reg_r,reg_q[31]} - {1'b0,reg_b}; // - b
   assign q = reg_q;
   assign r = reg_r[15]? reg_r + reg_b : reg_r; // adjust r
always @ (posedge clk or negedge reset) begin
       if (!reset) begin
           busy <= 0;
           ready <= 0;
        end 
        else begin
           if (start) begin
              reg_q <= a; // load a
              reg_b <= b; // load b
              reg_r <= 0;
              busy <= 1;
              ready <= 0;
              count <= 0;
        end else if (busy) begin
              reg_q <= {reg_q[30:0],~sub_add[16]}; // << 1
              reg_r <= sub_add[15:0];
              count <= count + 5'b1; // count++
         if (count == 5'h1f) begin // finish
               busy <= 0;
               ready <= 1; // q,r ready
           end
       end
    end
end
endmodule


Testbench:

module tb();
   reg [31:0] a; // dividend
reg [15:0] b; // divisor
reg start; // start
reg clk,reset; // clk,reset
wire [31:0] q; // quotient
wire [15:0] r; // remainder
wire busy; // busy
wire ready; // ready
wire [4:0] count; // counter

//Device Under Test(DUT)
 divider_32 test(a,b,start,clk,reset,q,r,busy,ready,count);
 always
  #2 clk=~clk; 
  
initial begin
   reset=0;
clk=0;
start=0;
a=32'h4c7f228a;
b=32'h6a0e;
#2
reset=1;
start=1;
#1
start=0;

end

endmodule

Timing Parameters:

  Minimum period: 5.325ns (Maximum Frequency: 187.786MHz)
 Minimum input arrival time before clock: 4.389ns
 Maximum output required time after clock: 4.252ns

Simulational Results:







Comments

  1. Thanks for your effort for giving test bench also and you are only one who provide complete expected code.

    ReplyDelete
  2. Great post ☺️

    ReplyDelete
  3. Wow Non restore also added

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