Ieee 1076-2008 Vhdl-200X
Total Page:16
File Type:pdf, Size:1020Kb
IEEE 1076-2008 VHDL-200X By Jim Lewis, SynthWorks VHDL Training [email protected] SynthWorks IEEE 1076-2008 O IEEE VASG - VHDL-200X effort O Started in 2003 and made good technical progress O However, no $$$ for LRM editing O Accellera VHDL TSC O Took over in Fall 2005, O Prioritized IEEE proposals, O Finalized LRM text, O Completed Accellera standard in July 2006 O Vendors implemented some features and provided feedback O In Spring 2008, Accellera forwarded standard to IEEE VASG for IEEE standardization. * VHDL-2008 * Approved in September by IEEE REVCOM 2 Copyright © SynthWorks 2008 SynthWorks IEEE 1076-2008 O Biggest Language change since 1076-1993 O PSL O Expressions in port maps O IP Protection via Encryption O Read out ports O VHDL Procedural Interface - VHPI O Conditional and Selected O Type Generics assignment in sequential code O Generics on Packages O hwrite, owrite, … hread, oread O Arrays with unconstrained arrays O to_string, to_hstring, … O Records with unconstrained arrays O Sized bit string literals O Fixed Point Packages O Unary Reduction Operators O Floating Point Packages O Array/Scalar Logic Operators O Hierarchical references of signals O Slices in array aggregates O Process(all) O Stop and Finish O Simplified Case Statements O Context Declarations O Don't Care in a Case Statement O Std_logic_1164 Updates O Conditional Expression Updates O Numeric_Std Updates O Numeric_Std_Unsigned 3 Copyright © SynthWorks 2008 SynthWorks VHDL-2008 Big Ticket Items PSL O PSL has been incorporated directly into VHDL O Vunit, Vmode, Vprop are VHDL Design Units O Properties are VHDL block declarations O Directives (assert, cover) are VHDL concurrent statements IP Protection and Encryption O A pragma-based approach O Keywords and constructs specify algorithms and keys O Constructs demarcated protected envelopes of VHDL code VHDL Procedural Interface - VHPI O Standardized Procedural Programming Interface to VHDL O Gives tools access to information about a VHDL model during analysis, elaboration, and execution 4 Copyright © SynthWorks 2008 SynthWorks Formal Type and Subprogram Generics + Packages with Generic Clause package ScoreBoardPkg is generic ( type BaseType ; function check(A, E : BaseType) return boolean ) ; . end ScoreBoardPkg ; O Specify generics in a package instance to create a new package library IEEE ; use ieee.std_logic_1164.all ; package ScoreBoardPkg_slv8 is new work.ScoreBoardPkg generic map ( BaseType => std_logic_vector(7 downto 0), check => std_match ) ; 5 Copyright © SynthWorks 2008 SynthWorks Composites with Unconstrained Elements Arrays of Unconstrained Arrays type std_logic_matrix is array (natural range <>) of std_logic_vector ; signal A : std_logic_matrix(5 downto 0)(7 downto 0) ; Records with Unconstrained Array Elements type complex is record a : std_logic ; re : ieee signed ; im : signed ; end record ; signal B : complex (re(7 downto 0), im(7 downto 0)) ; 6 Copyright © SynthWorks 2008 SynthWorks Fixed Point Types O Definitions in package, ieee.fixed_pkg.all type ufixed is array (integer range <>) of std_logic; type sfixed is array (integer range <>) of std_logic; O For downto range, whole number is on the left and includes 0. constant A : ufixed (3 downto -3) := "0110100" ; 3210 -3 IIIIFFF 0110100 = 0110.100 = 6.5 O Math is full precision math: signal A, B : ufixed (3 downto -3) ; signal Y : ufixed (4 downto -3) ; . Y <= A + B ; 7 Copyright © SynthWorks 2008 SynthWorks Floating Point Types O Definitions in package, ieee.float_pkg.all type float is array (integer range <>) of std_logic; O Format is Sign Bit, Exponent, Fraction signal A, B, Y : float (8 downto -23) ; 8 76543210 12345678901234567890123 S EEEEEEEE FFFFFFFFFFFFFFFFFFFFFFF E = Exponent has a bias of 127 F = Fraction with implied 1 left of the binary point 0 10000000 00000000000000000000000 = 2.0 0 10000001 10100000000000000000000 = 6.5 0 01111100 00000000000000000000000 = 0.125 = 1/8 Y <= A + B ; -- FP numbers must be same size 8 Copyright © SynthWorks 2008 SynthWorks Hierarchical Reference O Direct hierarchical reference: A <= <<signal .top_ent.u_comp1.my_sig : std_logic_vector >>; O Specifies object class (signal, shared variable, constant) O path (in this case from top level design) O type (constraint not required) O Using an alias to create a local short hand: Alias u1_my_sig is <<signal u1.my_sig : std_logic_vector >>; O Path in this case refers to component instance u1 (subblock of current block). O Can also go up from current level of hierarchy using "^" 9 Copyright © SynthWorks 2008 SynthWorks Force and Release O Forcing a port or signal: A <= force '1' ; O For in ports and signals this forces the effective value O For out and inout ports this forces the driving value O Forcing the effective value of an out or inout: A <= force in '1' ; -- driving value, effects output O Can also specify "in" with in ports and "out" with out ports, but this is the default behavior. O Releasing a signal: A <= release ; 10 Copyright © SynthWorks 2008 SynthWorks Process (all) O Creates a sensitivity list with all signals on sensitivity list Mux3_proc : process(all) begin case MuxSel is when "00" => Y <= A ; when "01" => Y <= B ; when "10" => Y <= C ; when others => Y <= 'X' ; end case ; end process O Benefit: Reduce mismatches between simulation and synthesis 11 Copyright © SynthWorks 2008 SynthWorks Simplified Case Statement O Allow locally static expressions to contain: O implicitly defined operators that produce composite results O operators and functions defined in std_logic_1164, numeric_std, and numeric_unsigned. constant ONE1 : unsigned := "11" ; constant CHOICE2 : unsigned := "00" & ONE1 ; signal A, B : unsigned (3 downto 0) ; . process (A, B) begin case A xor B is when "0000" => Y <= "00" ; when CHOICE2 => Y <= "01" ; when "0110" => Y <= "10" ; when ONE1 & "00" => Y <= "11" ; when others => Y <= "XX" ; end case ; end process ; 12 Copyright © SynthWorks 2008 SynthWorks Case? = Case With Don't Care O '-' represents don't care in case? choice O Allow '-' in case? choice provided all choices are non-overlapping -- Priority Encoder process (Request) begin case? Request is when "1---" => Grant <= "1000" ; when "01--" => Grant <= "0100" ; when "001-" => Grant <= "0010" ; when "0001" => Grant <= "0001" ; when others => Grant <= "0000" ; end case ; end process ; Note: Only '-' in the case? choice is treated as a don't care. A '-' in the case? expression will not be treated as a don't care. 13 Copyright © SynthWorks 2008 SynthWorks Simplified Conditional Expressions O Current VHDL syntax: if (Cs1='1' and nCs2='0' and Addr=X"A5") then if nWe = '0' then O New: Allow top level of condition to be std_ulogic or bit: if (Cs1 and not nCs2 and Cs3) then if (not nWe) then O Create special comparison operators that return std_ulogic (?=, ?/=, ?>, ?>=, ?<, ?<=) if (Cs1 and not nCs2 and Addr?=X"A5") then DevSel1 <= Cs1 and not nCs2 and Addr?=X"A5" ; O Does not mask 'X' 14 Copyright © SynthWorks 2008 SynthWorks Hwrite, Hread, Owrite, Oread O Support Hex and Octal read & write for all bit based array types procedure hwrite ( Buf : inout Line ; VALUE : in bit_vector ; JUSTIFIED : in SIDE := RIGHT; FIELD : in WIDTH := 0 ) ; procedure hread ( Buf : inout Line ; VALUE : out bit_vector ; Good : out boolean ) ; procedure oread ( . ) ; procedure owrite ( . ) ; O No new packages. Supported in base package O For backward compatibility, std_logic_textio will be empty 15 Copyright © SynthWorks 2008 SynthWorks To_String, To_HString, To_OString O Create to_string for all types. O Create hex and octal functions for all bit based array types function to_string ( VALUE : in std_logic_vector; ) return string ; function to_hstring ( . ) return string ; function to_ostring ( . ) return string ; O Formatting Output with Write (not write from TextIO): write(Output, "%%%ERROR data value miscompare." & LF & " Actual value = " & to_hstring (Data) & LF & " Expected value = " & to_hstring (ExpData) & LF & " at time: " & to_string (now, right, 12)) ; 16 Copyright © SynthWorks 2008 SynthWorks Sized Bit String Literals O Currently hex bit string literals are a multiple of 4 in size X"AA" = "10101010" O Allow specification of size (and decimal bit string literals): 7X"7F" = "1111111" 7D"127" = "1111111" O Allow specification of signed vs unsigned (extension of value): 9UX"F" = "000001111" Unsigned 0 fill 9SX"F" = "111111111" Signed: left bit = sign 9X"F" = "000001111" Defaults to unsigned O Allow Replication of X and Z 7X"XX" = "XXXXXXX" 7X"ZZ" = "ZZZZZZZ" 17 Copyright © SynthWorks 2008 SynthWorks Signal Expressions in Port Maps U_UUT : UUT port map ( A, Y and C, B) ; O Needed to avoid extra signal assignments with OVL O If expression is not a single signal, constant, or does not qualify as a conversion function, then O convert it to an equivalent concurrent signal assignment O and it will incur a delta cycle delay 18 Copyright © SynthWorks 2008 SynthWorks Read Output Ports O Read output ports O Value read will be locally driven value O Assertions need to be able to read output ports 19 Copyright © SynthWorks 2008 SynthWorks Allow Conditional Assignments for Signals and Variables in Sequential Code O Statemachine code: if (FP = '1') then NextState <= FLASH ; else NextState <= IDLE ; end if ; O Simplification (new part is that this is in a process): NextState <= FLASH when (FP = '1') else IDLE ; O Also support conditional variable assignment: NextState := FLASH when (FP = '1') else IDLE ; 20 Copyright © SynthWorks 2008 SynthWorks Allow Selected Assignments for Signals and Variables in