📜 ⬆️ ⬇️

Junior FPGA Design Engineer: how to become?

Hello!

Sometimes novice developers are not very well aware of what literature should be read in order to seriously study a particular language.

Development under FPGA (FPGA) is not just any language. This is a very voluminous area, with a huge number of pitfalls and nuances.
')
In this article you will find:

Welcome under the cut!

What you need to know and be able to


Digital circuit design


It is necessary:

Literature :

Test questions :
  1. What is the difference between digital circuitry and analog?
  2. What are the basic digital nodes? In which of them the output depends only on the input?
  3. What is a multiplexer? Draw a 4 in 1 multiplexer circuit from the primitive elements AND / OR / NOT.
  4. Build a truth table for the expression: X = A or (B and C) or D.

HDL syntax


This includes:

As an HDL language, I recommend first learning the most basic constructs of Verilog 'a, and then switching to SystemVerilog .

Literature :

Test questions :
  1. How is blocking assignment different from non-blocking? When should one apply when another?
  2. Is there a difference between the following three descriptions? If so, what is it manifested in?
    // code 1: assign a = b + c; // code 2: always @( b or c ) begin a = b + c; end // code 3: always @( * ) begin a = b + c; end 


Test items :
1. Draw a pattern from the base digital nodes for the following code:
Hidden text
 module test( input clk_i, input a_i, input [2:0] b_i, output reg x_o ); reg [7:0] cnt = 8'd0; reg [7:0] cnt2; wire c; reg d; always @( posedge clk_i ) cnt <= cnt + 1'd1; always @(*) begin cnt2 = cnt + 1'd1; end assign c = ( cnt < 8'd5 ) && ( a_i == 1'b0 ); always @( posedge clk_i ) begin d <= c; x_o <= c ? ( d ) : ( cnt2[ b_i ] ); end endmodule 


2. Draw the behavior of the circuit from item 1 (i.e. the state of all “variables”) under the following input influences:


Hidden text
Timeteps are drawn using the online WaveDrom editor.


3. Write a module to control the traffic light, which will light red, yellow and green lights in the well-known sequence: red, red and yellow, green, green blinks, yellow, red. The parameters that specify the burning time of traffic lights and the flashing period of the green light are the parameters of the module. The time is set in the number of clock cycles clk_i .

Module Interface:
Hidden text
 module traffic_light( // c input clk_i, //   input rst_i, //  1,    ,  0 —     output red_o, output yellow_o, output green_o ); 


Simulation and verification of HDL-code


It is necessary:

Literature :

Video Tutorials :

Test questions :
  1. How does function differ from task ?
  2. Imagine that you wrote the simplest HDL model of a 5-stage RISC processor. How will you verify it? (The issue of increased complexity ).
  3. What is the difference between a queue and a mailbox (data types in the SystemVerilog language)?
  4. What is the difference between functional simulation and temporary one? When what should be used?


Fpga


It is necessary:

I work with Altera chips, so here and beyond the name of the families and utilities will be from this vendor. If you know similar literature for Xilinx - write in a personal or in the comments - I will definitely add it to the article.

Literature :

Video Tutorials :

Test questions :
  1. What is the difference between FPGA and ASIC? What blocks does the FPGA consist of (or can it consist of)?
  2. Try to outline the range of tasks for which it is good (economically feasible) to use FPGA, and for which MCU and CPU?
  3. What hardware blocks do you know? What are they used for? (By hardware blocks we mean Hard IP ).
  4. The Y family uses LUT with three inputs and one output. What is the minimum number of LUTs to calculate assign eq = (a == b); if a and b are 32-bit positive integers? And if LUT has four (five, six) inputs?
  5. You need to create a single-port memory of 16 words. Each word is 100 bits wide. How many M9K blocks (9216 bits) will be occupied? We believe that we are doing a project under Cyclone III. (*)

In questions marked with (*) , of course, do not need to remember everything by heart, but you can use datasheets.

Synchronous design and everything related to timings


It is necessary:

Literature :

Test questions :
  1. What are timing constraints? Where are they described and what are they for (what are they used for)? What happens if you do not describe them?
  2. What is clock domain crossing ? How and when should it be carried out?
  3. What is the difference between synchronous and asynchronous reset? What will happen if a synchronous reset input has an asynchronous reset?
  4. What is a latch (latch, latch)? What are the consequences of using latch? Give an example of the code that creates latch.
  5. What is a combination loop? What are the consequences of using a combination loop?
  6. What is metastability ? How to achieve it? What are its pros and cons?
  7. What is a glitch? Do I need to deal with this? And if so, where and how?
  8. What is setup time / hold time for a D-trigger?


CAD


It is necessary:

Literature:

Video Tutorials :


Test questions :
  1. What stages of assembly occur from clicking on the “Collect the project completely” button to get the finished binary file? What happens at each stage?
  2. How to see if the CAD was able to put the project in the specified constraints (constraints)?

Lectures and laboratory


I spent two semesters reading the FPGA Development course for senior students at universities in St. Petersburg. The course included both lectures and a set of laboratory works. Lectures were based on the literature listed above.

Course Plan:
Hidden text
 : *   ?  . *   ( Quartus ).   Verilog: *      ( HDL ). * /  . *    : *      . * , /   *  . *     . *     . * /  . * . *   Verilog   . *     ( +SystemVerilog ): *    . . Testbench.    testbench. *    testbench'. *  .   . *     ( ,   .. ). *   tasks. *   . *      . * SystemVerilog Assertions. *  testbench    . *  c  (  ) . 



Names of lectures (in 2015):
  1. Introduction to FPGA.
  2. Internal FPGA device.
  3. Introduction to Verilog / SystemVerilog. Examples of the description of various types of logic.
  4. Synchronous design. Create simple testbenches.
  5. Description of FSM, arrays and structures in SystemVerilog. Memory: creation with Verilog and MegaWizard.
  6. How DCFIFO works. Static Timing Analysis. TimeQuest, constraints.
  7. Verification: coverage, assertions, SystemVerilog interfaces
  8. Interfaces family Avalon. IP Cores. Qsys.
  9. Verification: SystemVerilog OOP, constrained-random tests.


Lecture slides
Hidden text
Unfortunately, these are the SLIDES who helped me to give lectures (not all the course information is contained on the slides, some I used as a support, and the material was given on the board).

Sometimes there will be pictures that are not related to the neighboring ones (for example, tasks for tests that were given at lectures).

Laboratory work :

Classic mistakes


In this part of the article I will talk about common mistakes that novice developers make, and give advice on how to fix them.

Confusion in assignments (blocking and non-blocking)


Symptoms :

Treatment :


Timing problem


Symptoms :

Treatment :

If you see oddities in SignalTap, then double-check whether the signals you are shooting with the “gating” frequency are synchronous.

Not following the principles of synchronous design (asynchronous)


Continuation of the first paragraph, but I decided to allocate it separately.

Symptoms are similar with the previous paragraph.

For some reason, many people like to do this:
 // BAD EXAMPLE ... input clk_i, ... logic [7:0] sec_cnt; logic [7:0] min_cnt; logic last_sec_value; assign last_sec_value = ( sec_cnt == 8'd59 ); always_ff @( posedge clk_i ) if( last_sec_value ) sec_cnt <= 'd0; else sec_cnt <= sec_cnt + 1'd1; always_ff @( posedge last_sec_value ) min_cnt <= min_cnt + 1'd1; 


Those. The input signal on the min_cnt trigger uses a different signal than the sync pulse clk_i . It is formed by combinational logic (the output of the comparator).

Or like this:
 // BAD EXAMPLE ... input clk_a_i, input clk_b_i, ... logic [7:0] cnt_a; logic [7:0] cnt_b; logic [7:0] sum; always_ff @( posedge clk_a_i ) cnt_a <= cnt_a + 1'd1; always_ff @( posedge clk_b_i ) cnt_b <= cnt_b + 1'd1; always_ff @( posedge clk_b_i ) sum <= cnt_a + cnt_b; 


The input of the trigger sum comes the output of combinational logic, the input of which is powered by different clock signals.

Both examples are wrong , never do that! These examples are a clear violation of the rules of synchronous design.

I guess it all comes from the 2000s, when the chips were small and the developers survived as best they could.
Most likely at small frequencies (such as 1 MHz) it rolled, but if you are going to join a team that does serious things on top-end chips, then for such tricks you can easily fly out of the internship.

Treatment :


Continuous debugging on hardware (ignoring simulation)


You make this mistake if the development looks like this:

Why is that bad:

Treatment :

If something does not work on iron, then:


No development rules (+ code with backfill )


Symptoms :

Treatment :

Conclusion


I hope that in this article I have revealed that it is necessary to read and know in order to enter the world of development for FPGA.

I am sure that if you:

you can easily claim the position of a junior in a serious company.

Of course, this path can not be mastered in one weekend. It may take a month and not one, but this path must be taken if you want to go from student FPGA to professional development.

Thanks for attention!
As always, I will be glad to questions and comments in the comments or in personal mail.

PS
Sometimes they write to me in PM:
Good day.
I am a student of 3 (4, 5) courses of such a university.
I like the idea of ​​writing under FPGA (concurrency, you can do what you want, blah blah blah) and like Java (made simple Android applications). I want to do something of this more or less seriously. What do you advise to teach?

Most often, I offer them to look at two references ( FPGA and JAVA ) and draw conclusions on their own.

Source: https://habr.com/ru/post/281525/


All Articles