Skip to main content

SRAM/Memory CAD Engineer at Qualcomm

  Hello Dear Readers, Qualcomm Bangalore currently has a vacancy for an SRAM/Memory CAD Engineer. As a leading technology innovator, Qualcomm pushes the boundaries of what's possible to enable next-generation experiences and drives digital transformation to help create a smarter, connected future for all. As a Qualcomm Hardware Engineer, you will plan, design, optimize, verify, and test electronic systems, bring-up yield, circuits, mechanical systems,  Digital/Analog/RF/optical  systems, equipment and packaging, test systems, FPGA, and/or DSP systems that launch cutting-edge, world class products. Qualcomm Hardware Engineers collaborate with cross-functional teams to develop solutions and meet performance requirements. Minimum Qualifications: • Bachelor's degree in Computer Science, Electrical/Electronics Engineering, Engineering, or related field and 3+ years of Hardware Engineering or related work experience. OR Master's degree in Computer Science, Electrical/Electronic...

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

Internship - SoC /IP Design at NXP India

Hello Dear Readers, Currently, at NXP India  vacancy for  Internship - SoC /IP Design   role.   We are looking for a Master degree student with Electronics and Communication Engineering, or related field, with an emphasis on SoC design. This is a full-time internship with a duration of about 11-12 months. Job Responsibility: Working with our experienced design team to design state of the art SoC hardware specific segment applications like Automotive, IoT, voice/object recognition, security, smart connectivity and touch sensing . Assisting experienced engineers with End-to-end ownership of SoC Design, Verification and implementation (Physical Design). Design and verify digital and Mixed-signal IPs. Document designs and present results. Job Qualification: Master student in electronic/computer engineering Creative and positive mindset Good knowledge on CMOS technologies Great communication skills, interpersonal skills, teamwork skills and can-do attitude Desire for a ca...

Best Book for Designing Microarchitecture of Microprocessor Using Verilog HDL

  Hello Dear Readers, Currently, after succeeding in many topics now I starting to provide technical book reviews which were I have completed and still read books always. So let us start today's book review. Book Name:   Computer Principles and Design in Verilog  HDL Description:  Uses Verilog HDL to illustrate computer architecture and microprocessor design, allowing readers to readily simulate and adjust the operation of each design, and thus build industrially relevant skills Introduces the computer principles, computer design, and how to use Verilog HDL (Hardware Description Language) to implement the design Provides the skills for designing processor/arithmetic/cpu chips, including the unique application of Verilog HDL material for CPU (central processing unit) implementation Despite the many books on Verilog and computer architecture and microprocessor design, few, if any, use Verilog as a key tool in helping a student to understand these design techniques...

Exploring the Role of LEF Files in VLSI Chip Design: A Beginner's Guide

Hello Dear Readers,   Today in this post, I will provide some deep insight into the LEF file role during the VLSI Chip Design process. In VLSI (Very Large Scale Integration) design, a LEF file is a file that contains information about the physical geometry of the standard cells used in a circuit. LEF stands for Library Exchange Format. A standard cell is a pre-designed logic cell that contains a specific function, such as a flip-flop or an AND gate. Standard cells are designed to be easily combinable and scalable to create more complex circuits. The physical geometry of each standard cell is defined in the LEF file. The LEF file contains information such as the width, height, and position of the pins and metal layers of each standard cell. It also contains information about the physical design rules that govern the placement of these cells on the chip. LEF files are important in VLSI design because they enable the interoperability of different design tools from different vend...