Wednesday, November 19, 2014

Clock Divider Implementations


References:

                            http://www.slideshare.net/DeepakFloria/divide-by-n-clock



In this post first explain even number clock dividers next odd number clock dividers after you can find the references.


Divide by-2 clock:

//Design

module divide_by_2(rst_n,clk,gen_by2_clk);
  input rst_n;
  input clk;
  output gen_by2_clk;
 
  reg reg1;
 
  always @ (posedge clk,negedge rst_n)
  begin
  if(!rst_n)
    begin
      reg1 <= 1'b0;
    end
  else
    begin
      reg1 <= ~reg1;
    end
  end
 
    assign gen_by2_clk = reg1;

endmodule
//Test Bench

`timescale 1ns/1ns
module tb_divide_by_2;

reg rst_n;
reg clk;

wire gen_by2_clk;

divide_by_2 U1(rst_n,clk,gen_by2_clk);

initial begin
  clk = 1'b0;
  forever begin
  #1;
  clk = ~clk;
  end
end

initial begin
  rst_n = 1'b0;
  #2;
  rst_n = 1'b1;
  #100;
  $finish;
end

endmodule




Divide by-4 clock:

//Design

module divide_by_4(rst_n,clk,gen_by4_clk);
  input rst_n;
  input clk;
  output gen_by4_clk;
 
  reg [1:0]reg1;
 
  always @ (posedge clk,negedge rst_n)
  begin
  if(!rst_n)
    begin
      reg1 <= 2'b00;
    end
  else
    begin
      reg1 <= reg1 + 1'b1;
    end
  end
 
    assign gen_by4_clk = reg1[1];

endmodule
//Test Bench

`timescale 1ns/1ns
module tb_divide_by_4;

reg rst_n;
reg clk;

wire gen_by4_clk;

divide_by_4 U1(rst_n,clk,gen_by4_clk);

initial begin
  clk = 1'b0;
  forever begin
  #1;
  clk = ~clk;
  end
end

initial begin
  rst_n = 1'b0;
  #2;
  rst_n = 1'b1;
  #100;
  $finish;
end

endmodule

Tuesday, November 4, 2014

FPGA Interview Questions

Q. What is FPGA?

ANS: Field Programmable Gate Array is a semiconductor device containing programmable logic components called "logic blocks", and programmable interconnects.
Logic blocks can be programmed to perform the function of basic logic gates such as AND, and XOR, or more complex combinational functions such as decoders or mathematical functions. In most FPGAs, the logic blocks also include memory elements, which may be simple flip-flops or more complete blocks of memory.

Q. What are DCM’s? Why they are used?

ANS: Digital clock manager (DCM) is a fully digital control system that uses feedback to maintain clock signal characteristics with a high degree of precision despite normal variations in operating temperature and voltage. That is clock output of DCM is stable over wide range of temperature and voltage, and also skew associated with DCM is minimal and all phases of input clock can be  obtained . The output of DCM coming from global buffer can handle more load.
Q. What are the differences between FPGA and CPLD?
ANS:
FPGA:
A) SRAM based technology.
B) Segmented connection between elements.
C) Usually used for complex logic circuits.
D) Must be reprogrammed once the power is off.
E) Costly
CPLD:
A) Flash or EPROM based technology.
B) Continuous connection between elements.
C) Usually used for simpler or moderately complex logic circuits.
D) Need not be reprogrammed once the power is off.
E) Cheaper

Q. What is DFT ?
ANS: DFT means design for testability. 'Design for Test or Testability' - a methodology that ensures a design works properly after manufacturing, which later facilitates the failure analysis and false product/piece detection Other than the functional logic, you need to add some DFT logic in your design. This will help you in testing the chip for manufacturing defects after it come from fab.  Scan, MBIST, LBIST, IDDQ testing etc. are all part of this. (This is a hot field and with lots of opportunities)

Q. What is Synthesis?

ANS: Synthesis is the stage in the design flow, which is concerned with translating your Verilog code into gates - and that's putting it very simply! First of all, the Verilog must be written in a particular way for the synthesis tool that you are using. Of course, a synthesis tool doesn't actually produce gates - it will output a netlist of the design that you have synthesised that represents the chip which can be fabricated through an ASIC or FPGA vendor.

Q. What is slice? What is CLB?

ANS: The Configurable Logic Blocks (CLBs) constitute the main logic resource for implementing synchronous as well as combinatorial circuits. CLB are configurable logic blocks and can be configured to combo, ram or rom depending on coding style CLB consist of 4 slices and each slice consist of two 4-input LUT (look up table) F-LUT and G-LUT. The memory assignment is a clocked behavioural assignment, Reads from the memory are asynchronous, and all the address lines are shared by the read and write statements.

Q. Can a CLB configured as ram?

ANS: Yes

Q. What is the purpose of DRC?
ANS: DRC is used to check whether the particular schematic and corresponding layout (especially the mask sets involved) cater to a pre-defined rule set depending on the technology used to design. They are parameters set aside by the concerned semiconductor manufacturer with respect to how the masks should be placed, connected, routed keeping in mind that variations in the fab process does not effect normal functionality. It usually denotes the minimum allowable configuration.

Q. Compare PLL & DLL?

PLL:
PLLs have disadvantages that make their use in high-speed designs problematic, particularly when both high performance and high reliability are required. The PLL voltage-controlled oscillator (VCO) is the greatest source of problems. Variations in temperature, supply voltage, and manufacturing process affect the stability and operating performance of PLLs.
DLLs, these however, are immune to these problems. A DLL in its simplest form inserts a variable delay line between the external clock and the internal clock. The clock tree distributes the clock to all registers and then back to the feedback pin of the DLL. The control circuit of the DLL adjusts the delays so that the rising edges of the feedback clock align with the input clock. Once the edges of the clocks are aligned, the DLL is locked, and both the input buffer delay and the clock skew are reduced to zero.
Advantages:
· Precision
· Stability
· Power management
· Noise sensitivity
· Jitter performance.


Q. What is LVs and why do we do that. What is the difference between LVS and DRC?

ANS: The layout must be drawn according to certain strict design rules. DRC helps in layout of the designs by checking if the layout is abide by those rules. After the layout is complete we extract the netlist. LVS compares the netlist extracted from the layout with the schematic to ensure that the layout is an identical match to the cell schematic.

Q. Can you suggest some ways to increase clock frequency?
ANS:
· Check critical path and optimize it.
· Add more timing constraints (over constrain).
· Pipeline the architecture to the max possible extent keeping in mind latency req's.

Q. What is the significance of FPGAs in modern day electronics?
ANS:
·         Less time to Market when comparing with ASIC
·         It’s better for start-up companies to design their projects using FPGA Rather than ASIC side
·         Less Cost and Reconfigurable As many require number of times


Q. FPGA design flow?
ANS:
                



















Q. Tell me some features of FPGA you are currently using?

1.        FPGA Spartan3E:  (XC3S500E)
The Spartan 3E Starter Board provides a powerful and highly advanced self-contained development platform for designs targeting the Spartan 3E FPGA from Xilinx.
It features a 500K gate Spartan 3E FPGA with a 32 bit RISC processor and DDR interfaces.
The board also features
A Xilinx Platform Flash, USB and JTAG parallel programming interfaces with numerous FPGA configuration options via the onboard Intel StrataFlash and ST Microelectronics Serial Flash.
The board with a power supply and USB cable for programming so designs can be implemented immediately with no hidden costs.
The Spartan 3E Starter board is also compatible with the Micro Blaze Embedded Development Kit (EDK) and Pico Blaze from Xilinx.

2.    FPGA Spartan6: (XC6LX16-CS324)
The system development platform features Xilinx's newest Spartan-6 FPGA, 48Mbytes of external memory (including two non-volatile phase-change memories from Micron), and enough I/O devices and ports to host a wide variety of digital systems.

The on-board high-speed USB2 port provides board power, FPGA programming, and user-data transfers at rates up to 38Mbytes/sec.
A large collection of low-cost peripheral boards, including more than 30 Pmods and several new Vmods, can add additional features to the Nexys3,
 Including A/D and D/A converters, breadboards, motor drivers, displays, etc. The Nexys3 is fully compatible with all Xilinx tools, including the free  Chipscop, EDK (embedded processor design kit) and other tools.

Q. What is LUT?
 Look up Table:
·            Look-up tables (LUTs) are used to implement function generators in CLBs.
·            Four independent inputs are provided to each of two function generators                (F1-F4 and G1-G4).
·            These function generators can implement any arbitrarily defined Boolean function of four inputs.

Q. How to generate clocks on FPGA?
·         you need clock source regardless to drive FPGA ,
·         inside you can use PLL to generate specific frequencies.
·         Also you can use counters to scale down clock

Q. What are FPGA Editor File formats?
          FPGA Editor Reads and writes the following file types:

File Type
Input / Output
Definition
NCD
Input/Output
MAP or PAR generates the .ncd file. FPGA Editor uses this file with the New or Open command from the File menu.  You can edit the NCD file in the FPGA Editor.
PCF
Input/Output
A .pcf file is an ASCII file containing physical constraints created by the MAP program as well as physical constraints entered by you. You can edit the PCF file in the FPGA Editor.
NMC
Input/Output
An .nmc file contains a physical hard macro which can be created or viewed with the FPGA Editor.
ELF
Input
An .elf file (pronounced “elf”) is a binary data file that contains an executable CPU code image, ready for running on a CPU
DRF
Input
A .drf file (pronounced “dwarf”) is a binary data file that also contains the executable CPU code image, plus debug information required by symbolic source-level debuggers.
MEM
Input
A .mem file (memory) is a simple text file that describes contiguous blocks of data.
BIT
Output
A .bit file contains location information for logic on a device, including the placement of CLBs, IOBs, TBUFs, pins, and routing elements. The bitstream also includes empty placeholders that are filled with the logical states sent by the device during a readback. Only the memory elements, such as flip-flops, RAMs, and CLB outputs, are mapped to these placeholders, because their contents are likely to change from one state to another. When downloaded to a device, a bitstream configures the logic of a device and programs the device so that the states of that device can be read back.
CDC
Output
A .cdc file can be generated from the ILA command.



Q. How do you implement DCM?
the manual of my spatran 3E fpga kit says Alternatively, use the FPGA’s Digital Clock Manager (DCM) to generate or synthesize other frequencies from the on-board 50 MHz oscillator.

Q. Why is map-timing option used?
To improve design performance, timing, and packing for highly utilized designs.

Q. What are different types of timing verifications?

1.      Static timing:
2.      Dynamic timing:
a. The delays over all paths are added up.
a. The design is simulated in full timing mode.
b. All possibilities, including false paths, verified without the need for test vectors.
b. Not all possibilities tested as it is dependent on the input test vectors.
c. Much faster than simulations, hours as opposed to days.
c. Simulations in full timing mode are slow and require a lot of memory.
d. Not good with asynchronous interfaces or interfaces between different timing domains.
d. Best method to check asynchronous interfaces or interfaces between different timing domains.



Tuesday, October 14, 2014

Difference between VHDL, Verilog and System Verilog


http://www.amos.eguru-il.com/vhdl_info/Comparison_of_VHDL_Verilog_and_SystemVerilog.pdf

Tuesday, September 23, 2014

Reset: a synchronous or an asynchronous reset is useful in design?



following paper gives the more knowledge on resets.

References:


http://www.sunburst-design.com/papers/CummingsSNUG2003Boston_Resets.pdf



Monday, September 15, 2014

Verilog and System Verilog Interview Questions


MAHENDRA AND SATYAM INTERVIEW QUESTION

1.         What is Synthesis?
2.         Difference between int and integer.
3.         Difference between bit [7:0] and byte.
4.         Significance of logic.
5.         Advantage of dynamic array.
6.         Difference between dynamic array, queue and associative array.
7.         Difference between verilog and systemverilog.
8.         What is static and dynamic?
9.         Why can’t we use interface instead mailbox?
10.       What is callback?
11.       What is casting? How it works?
12.       Explain polymorphism with an example.
13.       What is encapsulation?
14.       Question regarding stratified event queue how blocking and non-blocking assignments happens in verilog.
15.       Simplify the equation x' + xy.
16.       Design xor gate using muxes.
17.       What is the use of modports?
18.       What is input clock skew and output clock skew?
19.       Difference between function and task.
20.       How to randomize a variable though it is not declared as rand/randc?
21.       How this array works arry [*] [$] [ ].
22.       Explain Driver code for RAM.
23.       Explain function new and super.build in UVM.
24.       Connect virtual interface in driver build_phase.
25.       Explain config_db and resource_db.
26.       Explain report phase in UVM.
27.       features of SV.
28.       What is the limitation of randc?
29.       Declaring a variable as rand, how to make use of that variable to work as randc.
30.       Explain about ignore bins.
31.       Explain code coverage.
32.       Explain raise objection.
33.       Explain global stop request.
34.       Difference between Mealy and Moore fsm.
35.       Design an fsm for sequence detector 1001.
36.       Difference between object and component.
37.       Difference between TLM 1.0 and TLM 2.0

Other Questions :

1. A ring counter having 10 pulses .how many flip-flops  needed ?
2. How many minimum number of gates required to implement Half adder ?
3.   tp =10ns,ts=6ns,th=2ns, calculate clock frequency.
           
4. Difference between task and  function  ? option  given.

5. Difference between Final and Initial block  ? option given.

6. Difference between Latch and Flip-Flops ? option given.

7. Difference between Create() and New() .

8. Find the minimum nu. of transistor required to implement    f= A(BC+BDE).Using CMOS
9. FIFO depth calculation.
10. Which gate is required to implement   4:16 decoder using two 3:8 decoder?
 a) AND                 b) XOR                  c) NOT                  d) OR                     e) All of them


11. NAND gate will be  ..........gate .if it uses  -ve logic .

12. Which statement will be execute in the below piece of code
casex(3’b110)
                3’bxx1 : statement 1;
                3’bx1x : statement 2;
                3’b1xx : statement 3;
                default : statement 4;
    endcase

13.
module test;
   reg  x,y ;
   reg [1:0] z;
initial
 begin
  fork
    x =1’b0;
    y =1’b1;
    z ={y,x};
  join
end
endmodule
what  should be the value of z in the above piece of code ?
14. In which of the following options callback can be always used
   a) Driver
   b) Scoreboard           
   c) Agent
   d) Mailbox
16. What is the value of “C” , if q = 1’bx in the below code
module test;
reg [1:0] a, b;
      reg  q;
     wire[1:0] c ;
    assign c =(q)?a:b;
  initial  begin
           a=2’b10; b=2’01;
end
endmodule

17. always@(posedge clk or negedge reset)
         begin
                if(reset)
                Q <= 1;
                else
                Q<=0 ;
        End

Which option is suitable for the above piece of code
a)      Asynchronous  reset
b)      Synchronous reset
c)       Asynchronous set
d)      Synchronous set

18. Which is not related to the race around condition? 
   a) Clocking block
   b) Program block
   c) Non-blocking
   d) Mailbox
   e) All of the above

19.  How many address lines are required to address 256*8 memory?
20. Two Mod 16 counter connected back to back  1st   is synchronous  & 2nd is ripple counter . 
     If each flip flop have propagation delay tp then what is the propagation delay of full circuit.
21. Which statement in the following code is wrong?
  Class abc ;
Integer abc_var ;
endclass
class cde extends abc ;
integer  abc_var   ;
endclass
program  test();
abc   abc_obj ,abc_obj1 ;
cde  cde_obj , cde_obj1 ;
abc_obj1  = new();
cde_obj = abc_obj1 ;
cde_obj1 = new();
abc_obj = cde_obj1;
endprogram


22. What type is a Microcontroller?
a) ASIC
b) CPLD
c) FPGA
d) ASSP
e) ISSP


Mobiveil Interview Questions
1) What is functional coverage and code coverage?
2) What is inheritance and polymorphism?
3)  Questions related to SVA.
4)  Verification flow for VMM and UVM.
5)  Difference between OVM and UVM.
6)  Questions related to SPI and UART project.
7) Draw verification environment in UVM.
8) Explain the different testcases and scenario to verify the following specification
           Consider a block with four 32 bit input channel and four 32 bit output channel, where as input channel are non blocking and each output channel with its own address individually. A packet of data can be forwarded through any one of  the input channel or in parallel manner. Packet consist of header, payload and crc bytes.
9)  Draw the verification environment in UVM.
10) Write down the code for transaction, driver, monitor for the above scenario.
11) Explain about the scoreboard needs for the above scenario.
12) How will you connect your driver & sequencer and where.
13) What is TLM?
14) Difference between TLM 1.0 and TLM 2.0
15) What is automation in UVM and its purpose?
16) What is configuration database and configuration object.
17) What is overriding in UVM and give some examples.
18) How will you connect your virtual interface in UVM environment.
19) How you will collect data to scoreboard and from where.
20) Explain about VMM and its flow.
21) How you will change static interface to dynamic interface.
22) Difference between for join and begin end.
23) Explain about UDP and FEC coverage.
24) Explain about coverage exclusion.
25) Explain about reusable environment in UVM.
26) Advantages and disadvantages of macros in UVM.
Synopsys Interview Questions

1)Draw the testbench architechture  of UVM and Explain.
2)Advantages of UVM over VMM.
3)What is the use of callbacks?
4)Explain a scenario which we need callbacks.
5)What is factory class?
6)How can we override transaction class in UVM and VMM?
7)While overriding how the handle assignment is  woking in factory?
8)How to randomize transaction class in sequence?
9)How to find the depth of analysis fifo?
10)Explain about configdb in UVM.
11)How config db is working in UVM?
12)How to map static and virtual interface using config db?
13)Write the code for the above mentioned scenario.

Interview Questions of Sandisk and PerfectVIP Technologies
                                Written Test
1)     Percentage Aptitude.
2)     Geometry –triangle  Aptitude.
3)     Logical reasoning.
4)     Sequence detection (2’s complement).
5)     Cubes Aptitude.
6)     Propagation delay.
7)     Flip-flop.
8)     Mux.
9)     FSM.
10)   Number systems Aptitude.
11)   Analog keyboard switch.
12)   Glitches.
13)   Setup and hold time.
14)   Counters.

                    Technical Interview
Round-1
1) What is Synchronous and Asynchronous devices and its type.
      Note:- Combinational circuit is asynchronous
2)  Different between latch and flip flop.
3) Why do you prefer System Verilog.ie., Advantages of system verilog over verilog.
Round-2
4)  Project flow and its details.
5)  Body effect and CMOS circuit connections.
6)  Types of encoding and which is the more advantage to use.
7)  Which one is more preferred in circuit design. NAND or NOR.
      Note:- input capacitance.
 8)  Types of canonical form, which is preferred.
 9)  Sensitivity list.
10)  Dual port RAM.
11)  Propagation delay.

12)  Explain Setup and Hold time with waveform example.
                 i) Violations
                 ii) How to prevent set and hold time violations.
13)  Draw frequency divide by 3 circuit and its waveform.
14)  What is inertial delay.
15)  Explain callbacks.
16)  What is TLM?
17)  Draw UVM flow diagram and explain about the different phases.
18)  What is the advantage of UVM over System verilog.
19)  Determine the output for the given programs which contains function, task and inheritance.
20) Write  system verilog verification environment to verify FIFO module.
      Specification details:-
                   Clk_read -10 MHz
                   Delay   - 2 cycle
                   Total capacity of burst-100 bytes [burst_width]
                   Clk_write – 15 MHz
                   Delay – 1cycle
                   Flags  - empty,full
21)  TB architecture for SV and explain each blocks and stages.
22)   Explain the following terms
                 i) Polymorphism
                 ii) Inheritance
                 iii) Clocking block
                          iv)  Modport
                 v)  Interface
Round-3
23)  Types of FSM, which type is implemented in your project.
24)  Is Ts and Th calculated for combinational circuits and gates.
25)  What is meta stability?
26)  What is verbosity?



Total Pageviews