Term
Unlike simulation, hardware inference is _______ |
|
Definition
|
|
Term
What constructs are unsupported in synthesis? |
|
Definition
|
|
Term
Logic from Dataflow is well suited for what? |
|
Definition
|
|
Term
What dataflow operators are not supported in synthesis? Which ones are modified? |
|
Definition
Unsupported ** / % Modified === becomes == !== becomes != |
|
|
Term
What is required for a procedural assignment? |
|
Definition
|
|
Term
For always blocks, what should be complete at all times? |
|
Definition
|
|
Term
When should an If statement be used over a Case statement? |
|
Definition
When you need priority encoded logic Need multiple conditions tested Speed is a priority |
|
|
Term
What advantages does a case statement have over an if? |
|
Definition
Creates balanced logic Tests common condition Useful for complex decoders |
|
|
Term
What's wrong with this module? module prio(q, a, b); output q; reg q; input [2:0] a; input b; always @(a) begin if (a[2]) q = b; else if (a[1]) q = ~b; else if (a[0]) q = 0; end endmodule |
|
Definition
Creates a latch - no else statement for if sequence. Either need to add an else, or make a default assignment. Sensitivity list incomplete, needs b added to it |
|
|
Term
What's wrong with this code? module prio3(q, a, b); output q; reg q; input [1:0] a; input b; always @(a, b) begin case(a) 1: q = b; 2: q = ~b; endcase end endmodule |
|
Definition
No default assignment for the case statement causes a latch. |
|
|
Term
How are loops handed in synthesis? What restrictions does this have? |
|
Definition
They are "unrolled" ie. logic repeated. Because of this, the synthesis tool must know the # of iterations at compile time and the # must be finite. |
|
|
Term
As a standard practice, what should be used to model a flip-flop? |
|
Definition
An always block with a non-blocking assignment for flip-flop. The nonblocking assignment ensures all registers update at the same time. |
|
|
Term
How do these two blocks synthesize? always @(posedge clk) //code versus always @(enable) if (enable) //code |
|
Definition
The first synthesizes to an edge triggered flip flop, while the second synthesizes to a level-sensitive latch. |
|
|
Term
What are general guidelines for flip-flops and latches? |
|
Definition
Don't mix flip-flops and latches Prefer flip-flops to latches unless you have a specific reason for using one over the other. |
|
|
Term
How are flip-flops and latches different? |
|
Definition
Flipflops require a larger are and more power Clock period is constant for all flipflops unlike latches Clock design for flipflops is easier and fully automated unlike latches where it is complex. |
|
|
Term
How would you add an asynchronous low reset to this block? Synchronous? always @(posedge clk) begin
q <= d; end |
|
Definition
For asynchronous in the sensitivity list add "or negedge rst" For either, replace the inside of the always block with if (!rst) q <= 0; else q <= d; |
|
|
Term
Spartan Primitive Library Elements: FD FDC FDR FDP FDE RAMB16Sn |
|
Definition
FD: D Flip flop FDC : D Flip flop asynchronous clear FDR : D Flip flop synchronous reset FDP : D Flip flop asynchronous preset FDE : D Flip flop synchronous enable RAMB16Sn : block RAM where n selects the config |
|
|
Term
What's wrong with this code? module dffrst(q, clk, rst, d); output q; req q; input clk, rst, d; always @(posedge clk or negedge rst) begin
if (rst) q <= 0; else q <= d; end endmodule |
|
Definition
the if(rst) needs to match the condition in the sensitivity list, in this case because of the negedge, it should be if(!rst) |
|
|
Term
What's wrong with this code? module dffrst(q, clk, rst, set, d); output q; req q; input clk, rst, d, set; always @(posedge clk or set) begin if (set) q <= 1; else if (rst) q <= 0; else q <= d; end endmodule
|
|
Definition
set needs to have either a posedge or negedge associated with it. |
|
|
Term
What's special about FPGA flipflops versus ASIC ones? |
|
Definition
They can be configured in an initialized state. |
|
|
Term
For a dataflow model: assign q = a + b * c; What must each of the variables (a, b, c, q) be defined as? |
|
Definition
q must be a wire a, b and c can either be wires or regs |
|
|
Term
For this code, what must each of the variables (a, b, c, q) be defined as? always @(a or b or c) begin
if (a > 2) q = a + b * c; else q = a - b * c; end |
|
Definition
q must be a register a, b and c can be either wires or regs |
|
|
Term
What in an FPGA implements gates and flipflops? |
|
Definition
|
|
Term
|
Definition
Input/Output Blocks. They provide off-chip connectivity for the FPGA. |
|
|
Term
|
Definition
Digital Clock manager for clock generation and distribution of the FPGA. |
|
|
Term
What are the 5 programmable elements in a regular FPGA Network? |
|
Definition
CLBs IOBs Block RAM Multiplier DCM |
|
|
Term
What allows the FPGA elements to interact? |
|
Definition
Programmable interconnections network |
|
|
Term
What is a Slice? What does each slice contain? |
|
Definition
A piece of a CLB - 4 per CLB. Each slice can work as logic (gates + flipflop), distributed RAM, or a shift register. Each slice has 2 LUTs, 2 flipflops, MUXes and Carry-logic |
|
|
Term
What is the left part of a Slice called? Right part? What can each do? |
|
Definition
Left is called SliceM and it can do logic, distributed RAM or shift register. Right is called SliceL, it can only do logic. |
|
|
Term
What connects Slices to the FPGA Network? |
|
Definition
|
|
Term
What is an LUT4? Where is it found? |
|
Definition
Act as either a logic function of up to 4 inputs, 16 bit ram, or 16 bit shift register. 4 bit input, 1 bit output. They are found in Logic Slices, 2 per slice |
|
|
Term
How can LUTs be extended to implement functions with a greater # of inputs? |
|
Definition
By using Multiplexers in the Slices. |
|
|
Term
What's the maximum number input LUT one CLB can implement? |
|
Definition
|
|
Term
What takes up the most physical area on a FPGA die, and uses the most power? |
|
Definition
|
|
Term
Why should gated clocks be avoided? |
|
Definition
Clock signals are distributed with a separate dedicated network that allows the clock to arrive everywhere at the same time. A gated clock extends out of the network, and makes it so that the clock signal might not arrive everywhere at the same time. |
|
|
Term
What are the basic parts of a Finite State Machine? |
|
Definition
Set of Inputs and Outputs Set of States Initial State (reset function) State Transitions |
|
|
Term
When defining state encoding, what verilog command is useful? |
|
Definition
Use parameter to define state codes: parameter s0 = 2'b00, s1 = 2'b01, s2 = 2'b10 |
|
|
Term
Describe the properties of a single always block FSM design. |
|
Definition
Reset and update in same block. Output will always have a register [image] |
|
|
Term
Describe the properties of a two always block FSM implementation. |
|
Definition
Reset and update still in same block. Output can be combinational. [image] |
|
|
Term
Describe the properties of a three always block FSM implementation. |
|
Definition
Reset and update in different blocks. Output can be combinational. [image] |
|
|
Term
|
Definition
A code sequence where subsequent state codes differ by only a single bit. Provides minimal logic transitions from one state to the next, minimal power consumption and minimal risk for glitches and hazards. |
|
|
Term
What is one-hot encoding? |
|
Definition
Selects one bit for each state - each state transition flips only two bits. Good for FPGA with lots of flip-flops, but not so efficient with a large number of states or state transitions. |
|
|
Term
What is sequential encoding? |
|
Definition
Encodes successive states in sequence. Simplifies next-state logic if there are long sequences. Keeps same encoding as specified by user. |
|
|
Term
What two main ways can the encoding option be defined? |
|
Definition
User Defined and Tool Defined. User defined, use 'pragma' or 'synthesis constant': (* fsm_encoding = user *) |
|
|
Term
For the following FSM block, how would you assign a default state of s0? always @(state or i) begin case (state) s0: if (i == 1'b0) next_state = s1; else next_state = s0; s1: .. endcase end |
|
Definition
Add: next_state = s0; before the case statement. |
|
|
Term
What is a 'Safe FSM'? When are they used? |
|
Definition
An FSM that will convert each invalid state automatically to a recovery state (usually the reset state) Used when proper, precisely defined operation is more important than cost (area, performance) |
|
|
Term
What are two options for FSM synthesis onto a FPGA? |
|
Definition
Synthesizing for BRAM for next-state logic and state register Synthesizing as LUT-based FSM (default) |
|
|
Term
In FPGA design, what's the difference between Inference and Instantiation? |
|
Definition
Inference defines elements that may or may not be in a primitive library, and adds them if necessary. Instantiation uses primitive library elements (e.g. FD) specific to the tools you're using. |
|
|
Term
What are the pros/cons of Inference/Instantiation? |
|
Definition
Inference provides portable code that can compile on multiple targets, simulate with a generic simulator and provides maximal freedom to synthesis tools. Instantiation gives designer maximal control over the synthesis process at the cost of nonportable code, assumption of a specific target, and use of a specific library. |
|
|
Term
What are memory elements used for? |
|
Definition
When multiple registers are attached to a single bus, memory elements are used to select a particular register. |
|
|
Term
Describe the possible port structure of a memory element? |
|
Definition
Can have single or multiple write ports. Can also have read ports. Possible to read/write simultaneosly. |
|
|
Term
Describe the structure of a single write port memory element. |
|
Definition
A decoder that takes a write address and connects to a register enables based on the decoded address. Registers are load-enable, edge triggered, and each one is connected to the write data. [image] |
|
|
Term
Describe the structure of a dual write port memory element. |
|
Definition
2 decoders to enable a reg based on a decoded addr. 2 datas connected to the regs by a multiplexer. One write port has priority so that if both ports are accessed, the higher priority one determines the reg selection and which data is written.
[image] |
|
|
Term
How many transistors are used by a standard D flipflop? |
|
Definition
|
|
Term
What solutions are available that use less are and power than a D-flipflop |
|
Definition
SRAM (6 transistors/bit) DRAM (1 transistor/bit) |
|
|
Term
Describe SRAM Architecture |
|
Definition
Row and Column Decoders used to access specific memory cells. Wordsize is equivalent to # of columns. # of words is equivalent to # of rows. [image] |
|
|
Term
Describe DRAM Architecture |
|
Definition
One transistor/capacitor per bit. Multiplexed address bus with Row and Col address selects. Leakage current causes capacitors to discharge in a few ms, so DRAM memory needs to be continuously rewritten or 'refreshed' Data is always read/written an entire row at a time. |
|
|
Term
What modes determine what data appears ont he data-output port of BlockRAM? |
|
Definition
Write First: write occurs before read Read First: read occurs before write No Change: data-output port isn't changed |
|
|
Term
How would you change this code for write first mode? read first mode? input we; // write_enable input [15:0] di; //data in reg [15:0] RAM [63:0]; //16-bit, 64 locations reg [15:0] do; //data out always @(posedge clk) begin if (en) begin if (we) **code** ... end end |
|
Definition
Read First: if (en) begin if (we) RAM[addr]<=di; do <= RAM[addr]; end Write First: if (en) begin if (we) RAM[addr]<=di; do <= di; end |
|
|
Term
What's wrong with this code? input [5:0] addr; input [15:0] di; //data in
output [15:0] do; //data out
reg [15:0] RAM [127:0]; //16-bit, 128 locations reg [15:0] do; always @(posedge clk) begin if (en) begin if (we) RAM[addr] <= di; do <= di; end end |
|
Definition
128 ram locations, only 6 address bits. |
|
|
Term
What does an Asynchronous read on BRAM cause? |
|
Definition
The RAM will be implemented on LUTs because Block Ram does not allow asynchronous reads. This will take many LUTs to implement. |
|
|
Term
In FPGA, what specifies the initial contents of BRAM? How can you initialize BRAM contents? |
|
Definition
The bitstream To initialize: initial for (i=0; i<64; i++) RAM[i]=i; or: $readmemh("hex.data", RAM, 0, 63) |
|
|
Term
What is the Area-Delay Product? |
|
Definition
A measure of performance of a design. Defined as Slices * clock cycles e.g. 400 slices, 20 cycles = 8000 Slices.cycles |
|
|
Term
What is resource sharing? |
|
Definition
Dividing combinational logic into smaller similar pieces and executing these pieces over multiple clock cycles to reduce area at the cost of performance. |
|
|
Term
What is the Hardware Sharing Factor? |
|
Definition
Expresses the potential amount of resource sharing in a digital design. It is the amount of clock cycles available per data item. HSF = fclk / max(fin,fout) |
|
|
Term
How can constant multiplication be optimized for area? |
|
Definition
When multiplying by a constant, the and gates either have a 1 or 0 associated with them, which can be reduced to a wire of either 'a' or 0 respectively. |
|
|
Term
|
Definition
Time it takes to compute an output starting from a given input |
|
|
Term
|
Definition
Rate at which new outputs are produced (or the rate at which new inputs are consumed) |
|
|
Term
What can performance be measured against typically? Delay? |
|
Definition
Performance = 1 / Throughput or 1 / Latency Delay = 1 / Performance |
|
|
Term
What is a timing violation? |
|
Definition
When the synthesis tools cannot match a desired clock period. |
|
|
Term
How can delay be improved? (generally) |
|
Definition
By either reducing the Cycle Count or the Clock Period. Delay = Cycle Count * Clock Period |
|
|
Term
What determines the minimum clock period? What can be changed to reduce the minimum clock period? |
|
Definition
Tclk,min = Tclk->Q + TLogic + TRouting + TSetup TLogic and TRouting can be reduced by the designer. |
|
|
Term
|
Definition
Time needed for the output of a flip-flop to switch to a new value after a clock edge has occurred. (Hardware Defined) |
|
|
Term
|
Definition
Time needed for the logic to calculate a new output. Caused by both gates and wires. (Design Defined) |
|
|
Term
|
Definition
Time needed for the flip-flop to capture stable input data at the next clock edge. (Hardware Defined) |
|
|
Term
|
Definition
Margin between the actual clock period and the minimal clock period. [image] |
|
|
Term
What three techniques can be used to optimize delay? |
|
Definition
Parallel Computations Pipelining Retiming |
|
|
Term
In order for elements to be run in parallel, what must be true about them? |
|
Definition
They must have the same delay. |
|
|
Term
How can if statements be optimized for speed? When is this possible? |
|
Definition
By replacing all else ifs with if statements. This allows all the if statements to run in parallel. Only an option when priority amongst the if statements is not necessary. |
|
|
Term
|
Definition
Method of cutting a long combinational path in pieces by inserting registers. Decreases Tlogic at the cost of latency. |
|
|
Term
How would you divide this structure into a 3 stage pipeline? What would be the resulting Tclk,min, Latency, and Throughput be? [image] |
|
Definition
|
|
Term
|
Definition
Also called register balancing. Method of pipelining such that pipeline stages divide the logic as evenly as possible between the stages. This is done by placing registers in smart spots, and by moving logic inbetween the stages. |
|
|
Term
|
Definition
Performed by the design tool, starts from the netlist, and runs automatically. It may report pessimistic results and report delays that will never occur during operation however. |
|
|
Term
|
Definition
Can be combined with simulations which we do for functional verification. Can be too optimistic if we don't simulate the worst possible case (which can be hard to predict). |
|
|
Term
What areas does Static Timing Analysis look for the worst possible delay? |
|
Definition
Delay from input to register Delay from register to register Delay from register to output |
|
|
Term
|
Definition
A measure of when the clock signal arrives at a particular flipflop in relation to other flipflops. Ideally clock skew is equal to 0. |
|
|
Term
Once technology is chosen, STA needs to find what? |
|
Definition
The longest combinational path, consisting of Tlogic and Trouting |
|
|
Term
How many paths must Static Timing Analysis cover to fully examine a design? |
|
Definition
If there are M inputs and N outputs, then there are M*N possible paths. |
|
|
Term
What makes up a Path Delay? |
|
Definition
Path Delay = Intrinsic Gate Delay + Fan-out Delay + Wire Delay |
|
|
Term
|
Definition
Delay of each gate when not connected |
|
|
Term
|
Definition
Delay caused by the input capacitance of gates in fan-out. The greater number of connections on a single net, the greater the fanout delay. |
|
|
Term
|
Definition
A path tested by Static Timing Analysis that will never happen in operation. These paths can cause STA to be pessimistic. |
|
|
Term
What do Tasks and Functions do in Verilog |
|
Definition
Allow code that is reused to be seperated into a block that can be called by other blocks. |
|
|
Term
How are Tasks and Functions different? |
|
Definition
Tasks... Can contain event control (@, #, wait) May execute in non-zero simulation time Can have 0 or more arguments of type in, out or inout Functions... Cannot contain event control Must execute in zero simulation time Must have at least one input argument Must have a single output argument |
|
|