intTypePromotion=1
zunia.vn Tuyển sinh 2024 dành cho Gen-Z zunia.vn zunia.vn
ADSENSE

Sequential Verulog Topics part 10

Chia sẻ: Dasdsadqwe Dsadasdsadsa | Ngày: | Loại File: PDF | Số trang:7

67
lượt xem
5
download
 
  Download Vui lòng tải xuống để xem tài liệu đầy đủ

Verilog HDL Synthesis For the purpose of logic synthesis, designs are currently written in an HDL at a register transfer level (RTL). The term RTL is used for an HDL

Chủ đề:
Lưu

Nội dung Text: Sequential Verulog Topics part 10

  1. 14.3 Verilog HDL Synthesis For the purpose of logic synthesis, designs are currently written in an HDL at a register transfer level (RTL). The term RTL is used for an HDL description style that utilizes a combination of data flow and behavioral constructs. Logic synthesis tools take the register transfer-level HDL description and convert it to an optimized gate-level netlist. Verilog and VHDL are the two most popular HDLs used to describe the functionality at the RTL level. In this chapter, we discuss RTL-based logic synthesis with Verilog HDL. Behavioral synthesis tools that convert a behavioral description into an RTL description are slowly evolving, but RTL-based synthesis is currently the most popular design method. Thus, we will address only RTL-based synthesis in this chapter. 14.3.1 Verilog Constructs Not all constructs can be used when writing a description for a logic synthesis tool. In general, any construct that is used to define a cycle-by-cycle RTL description is acceptable to the logic synthesis tool. A list of constructs that are typically accepted by logic synthesis tools is given in Table 14-1. The capabilities of individual logic synthesis tools may vary. The constructs that are typically acceptable to logic synthesis tools are also shown. Table 14-1. Verilog HDL Constructs for Logic Synthesis Construct Keyword or Notes Type Description ports input, inout, output parameters parameter module module definition signals and wire, reg, tri Vectors are allowed variables instantiation module instances, E.g., mymux m1(out, i0, i1, s); E.g., primitive gate instances nand (out, a, b); functions and function, task Timing constructs ignored tasks procedural always, if, then, else, initial is not supported
  2. case, casex, casez procedural begin, end, named Disabling of named blocks allowed blocks blocks, disable data flow assign Delay information is ignored loops for, while, forever, while and forever loops must contain @(posedge clk) or @(negedge clk) Remember that we are providing a cycle-by-cycle RTL description of the circuit. Hence, there are restrictions on the way these constructs are used for the logic synthesis tool. For example, the while and forever loops must be broken by a @ (posedge clock) or @ (negedge clock) statement to enforce cycle-by-cycle behavior and to prevent combinational feedback. Another restriction is that logic synthesis ignores all timing delays specified by # construct. Therefore, pre- and post-synthesis Verilog simulation results may not match. The designer must use a description style that eliminates these mismatches. Also, the initial construct is not supported by logic synthesis tools. Instead, the designer must use a reset mechanism to initialize the signals in the circuit. It is recommended that all signal widths and variable widths be explicitly specified. Defining unsized variables can result in large, gate-level netlists because synthesis tools can infer unnecessary logic based on the variable definition. 14.3.2 Verilog Operators Almost all operators in Verilog are allowed for logic synthesis. Table 14-2 is a list of the operators allowed. Only operators such as === and !== that are related to x and z are not allowed, because equality with x and z does not have much meaning in logic synthesis. While writing expressions, it is recommended that you use parentheses to group logic the way you want it to appear. If you rely on operator precedence, logic synthesis tools might produce an undesirable logic structure. Table 14-2. Verilog HDL Operators for Logic Synthesis Operator Type Operator Symbol Operation Performed Arithmetic * multiply / divide
  3. + add - subtract % modulus + unary plus - unary minus Logical ! logical negation && logical and || logical or Relational > greater than < less than >= greater than or equal
  4. ~| reduction nor ^ reduction ex-or ^~ or ~^ reduction ex-nor Shift >> right shift >> arithmetic right shift
  5. adder is implemented below. assign {c_out, sum} = a + b + c_in; Assuming that the 1-bit full adder is available internally in the logic synthesis tool, the above assign statement is often interpreted by logic synthesis tools as follows: If a multiple-bit adder is synthesized, the synthesis tool will perform optimization and the designer might get a result that looks different from the above figure. If a conditional operator ? is used, a multiplexer circuit is inferred. assign out = (s) ? i1 : i0; It frequently translates to the gate-level representation shown in Figure 14-3. Figure 14-3. Multiplexer Description The if-else statement Single if-else statements translate to multiplexers where the control signal is the signal or variable in the if clause. if(s) out = i1; else out = i0; The above statement will frequently translate to the gate-level description shown in Figure 14-3. In general, multiple if-else-if statements do not synthesize to large multiplexers. The case statement The case statement also can used to infer multiplexers. The above multiplexer would have been inferred from the following description that uses case statements: case (s)
  6. 1'b0 : out = i0; 1'b1 : out = i1; endcase Large case statements may be used to infer large multiplexers. for loops The for loops can be used to build cascaded combinational logic. For example, the following for loop builds an 8-bit full adder: c = c_in; for(i=0; i
  7. {c_out, sum} = a + b + c_in; The function statement Functions synthesize to combinational blocks with one output variable. The output might be scalar or vector. A 4-bit full adder is implemented as a function in the Verilog description below. The most significant bit of the function is used for the carry bit. function [4:0] fulladd; input [3:0] a, b; input c_in; begin fulladd = a + b + c_in; //bit 4 of fulladd for carry, bits[3:0] for sum. end endfunction  
ADSENSE

CÓ THỂ BẠN MUỐN DOWNLOAD

 

Đồng bộ tài khoản
2=>2