TWiki
>
P1076/Ballots Web
>
Vhdl2019CollectedRequirements
>
ClockedShorthand
(revision 9) (raw view)
Edit
Attach
---+ Clocked Shorthand %TOC% ---++ Proposal Details * Who Updates: Main.DanielKho, Main.JimLewis, ... * Date Proposed: 4 Jan 2012 * Date Last Updated: 4 Jan 2011 * Priority: * Complexity: * Focus: See also <a href="http://www.eda.org/isac/IRs-VHDL-2002/IR2034.txt" title="ISAC IR-2034">ISAC IR-2034</a> and <a href="http://www.eda.org/isac/IRs-VHDL-2002/IR2035.txt" title="ISAC IR-2035">ISAC IR-2035</a>. ---++ Related Issues * [[MultiCyclePath]]*. ---++ Current Situation A couple of discussion threads on the reflector expressed a desire for: * Shorthand for clocked processes - to reduce amount of boilerplate typing * Shorthand for pipelining - this was also referred to as adding a "z-transform" function. This has two benefits - reducing boilerplate code, but more importantly explicitly signalling the tools that a pipeline chain is what is required, and removing a clutter of intermediate signals which are otherwise explicit in the source. ((Also falling into this "heading" were some suggestions on a library of standard functions (like and, or, mux2, ....). I will discuss these in another place (link to be added!))) ---++ Requirement Summary To reduce the amount of typing involved in creating clocked processes To reduce intermediate signal clutter To more explicity state intention to tools Demonstrate (via examples) of support for numerous flip-flop coding styles: simple (no reset), reset (asynchronous, synchronous, power-on), load enable, mixing registers that have reset with those that do not, clock gates ---++ Code Examples & Use Models A number of possible syntaxes were discussed. ---+++ Non-Syntax Option: Use a procedure call per [[ExtendedHwFunctions]]. Reg(Clk, D, Q) ; RegPipe (Clk, D, Q, 5) ; -- adds a 5 deep pipelining / shift register. ---+++ Current Syntax Option: Q <= D when rising_edge(Clk) ; type RegBankType is array (gDEPTH downto 0) of std_logic_vector(gWIDTH downto 0) ; signal aQ : RegBankType ; aQ <= aQ(gDEPTH -1 downto 0) & D when rising_edge(Clk) ; Q <= aQ(gDEPTH) ; Tap1 <= aQ(TAP1_INDEX) ; With VHDL-2008 and unconstrained arrays of arrays could use a standard type for arrays of std_logic_vector ---+++ Proposed Syntax Option 6/16/2016: Q <= D @ 2 when rising_edge(Clk) ; Q <= D[2] when rising_edge(Clk) ; ... How does reset work and clear out the pipeline? Offers little over the vhdl-2008 syntax, especially for complex cases. Could work this in with channels proposal [[AsynchronousChannels]] ---+++ Syntax Option 1: Text originally on Collected Requirements Page: * Create default attributes to define registers * Syntax A <= B @ 2; -- B becomes A after 2 clock cycles * Predifined attribues like clock, reset, reset_value, enable, rising_edge would be needed. * Put on a signal, a group, or an entity. * Allow synthesis if "@ 2" is used, ignore synthesis (sim only) if "after 2 ns" or "@ 2 ns" is used. <verbatim>q <= d @ 2;</verbatim> or <verbatim>q <= d after 2;</verbatim> with the '2' implying 2 cycles. Attributes could then be assigned at the entity or signal level to define clock signal, reset value, enable, etc; <verbatim> attribute default_clock : STD_ULOGIC; attribute default_reset : STD_ULOGIC; attribute default_enable : STD_ULOGIC; attribute default_reset_value : STD_ULOGIC; attribute default_clock_edge : STD_ULOGIC; attribute default_clock of ent1 : entity is clk_sig;</verbatim> which could lead to a very compact definition. ---+++ Use Cases <verbatim>q <= d @ 2;</verbatim> Asynchronous resets: <verbatim>q <= x"0" when not nReset else d @ 2;</verbatim> Synchronous resets: <verbatim>q <= x"0" when not nReset and rising_edge(clk) else d @ 2;</verbatim> Mathematical example that uses asynchronous reset: <verbatim>q <= to_signed(0, dataWidth) when not enable else to_signed((d*123_456 - 78_901) / 2**d, dataWidth) @ 2;</verbatim> Allow '@' notation within processes, so as to tell the synthesis tool to implicitly add pipeline registers: <verbatim>p0: process(clk,enable) is begin if enable='0' then q <= to_signed(0, dataWidth); elsif rising_edge(clk) then q <= to_signed((d*123_456 - 78_901) / 2**d, dataWidth) @ 2; --more statements... end if; end process p0;</verbatim> For dual-edge-triggered processes, the pipelined signal should appear considering both edges of the clock: <verbatim>p1: process(clk,enable) is begin if enable='0' then q <= to_signed(0, dataWidth); elsif rising_edge(clk) or falling_edge(clk) then q <= to_signed((d*123_456 - 78_901) / 2**d, dataWidth) @ 2; --here, "@ 2" means after 2 edge detections, i.e. after both rising and falling edges. --more statements... end if; end process p1;</verbatim> ---++++ Arguments FOR The 1st option allows for the implicit creation of the pipeline signals to reduce clutter, and for simple pipelines without reset logic could provide a compact representation. Simplifies descriptions which are heavily mathematical- or DSP-based. Mathematical / DSP descriptions usually would require some level of pipelining, and the 1st option retains the original equations in the description. Without this, the description will be less understandable (the original equations will be "lost" or obscured), and it becomes more structural instead of behavioral. If the equations involved are fairly complex, option 1 will reduce the amount of typing significantly, as it reduces the many intermediate signals which would otherwise have to be declared. Also, this reduces the many structural blocks that need to be described. Imagine having to instantiate a power-of-x and a divider and a few other mathematical blocks separately, then connecting all of them structurally together. This introduces the ability to clock functions, as it signals the tool to automatically add pipeline registers even if the behaviour has been described using a set of functions. ---++++ Arguments AGAINST This sounds scary and error-prone to me. With this approach I have to look all over the declarative regions inside and outside the entity (if the attribute is specified where the entity is instantiated) to find out what my clock is! A decent IDE/editor removes most of the pain of boilerplate typing anyway. Is the implicit creation of signals a bit "non-VHDL"? ---+++ Syntax Option 2: Some more explicit variations on this theme include extending the definition of "time" to include events (and the * operator to count them, a bit like doing =2*1 ns=): <verbatim>q <= d after 2 * (rising_edge(clk) and enable = '1');</verbatim> Asynchronous resets could be achieved thus: <verbatim>q <= "0000" when nReset = '0' else d after 2 * (rising_edge(clk) and enable = '1');</verbatim> Synchronous resets would require something like: <verbatim>q <= "0000" after (rising_edge(clk) and nReset = '0') else d after 2 * (rising_edge(clk) and enable = '1');</verbatim> Mathematical example that uses asynchronous reset: -- Main.DanielKho - 2012-04-26 <verbatim>q <= to_signed(0, dataWidth) when not enable else to_signed((d*123_456 - 78_901) / 2**d, dataWidth) after 2 * rising_edge(clk);</verbatim> A variation on this using processes (processes are often needed for multiple sequential statements): -- Main.DanielKho - 2012-04-26 <verbatim>p0: process(clk,enable) is begin if enable='0' then q <= to_signed(0, dataWidth); elsif rising_edge(clk) then q <= to_signed((d*123_456 - 78_901) / 2**d, dataWidth) after 2; --more statements... end if; end process p0;</verbatim> For dual-edge-triggered processes, the pipelined signal should appear considering both edges of the clock: -- Main.DanielKho - 2012-03-11 <verbatim>p1: process(clk,enable) is begin if enable='0' then q <= to_signed(0, dataWidth); elsif rising_edge(clk) or falling_edge(clk) then q <= to_signed((d*123_456 - 78_901) / 2**d, dataWidth) after 2; --here, "after 2" means after 2 edge detections, i.e. after both rising and falling edges. --more statements... end if; end process p1;</verbatim> ---++++ Arguments FOR ---++++ Arguments AGAINST ---+++ Syntax Option 3: <verbatim>label: process [rising|falling] clock(Clk) is -- declaration region for constants, variables, aliases, etc. [asynchronous|synchronous] reset(Rst) -- reset logic begin -- non-reset logic end process; </verbatim> ---++++ Arguments FOR ---++++ Arguments AGAINST A comment was made that <pre>This change doesn't give a huge benefit, but it ought to be easy to specify and use. </pre> ---+++ Syntax Option 4: Another possibility would be to provide an extra attribute on signals: <verbatim>if clk'rising then</verbatim> again, the benefit is marginal. A variation on this theme was to allow functions in sensitivity lists to provide something like Verilog's sensitivity lists to define the clock edge (which reduces the need for the rising_edge() function within the process): <verbatim>process (rising_edge(clk), falling_edge(reset_n)) begin if reset_n = '0' then q <= '0' else q <= d; end if; end process;</verbatim> ---++++ Arguments FOR ---++++ Arguments AGAINST ---++ Use Cases ---+++ Syntax Option 5: Use PSL: <verbatim> q <= d after Tpd, e after T + Tpd, f after T + Tperiod_clk + Tpd;</verbatim> ---++ General Arguments FOR (not specific to a Syntax Option) ---++ General Arguments AGAINST (not specific to a Syntax Option) Most of the syntaxes are not much (if any) shorter than what everyone uses daily at the moment. ---++ General Comments -- Main.ErnstChristen - 2015-01-27 There are 2 proposals related to clock management. * [[P1076.ClockedShorthand][Clocked Shorthand]] - This proposal * [[P1076.PreponedProcess][Preponed Processes (clocks)]] It seems worthwhile to formulate generic requirements for handling clocks (semantics, usage, restrictions, etc.) before looking at individual aspects in isolation. ---++ Supporters _Add your signature here to indicate your support for the proposal_ -- Main.DanielKho - 2015-01-01
Edit
|
Attach
|
P
rint version
|
H
istory
:
r13
|
r11
<
r10
<
r9
<
r8
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r1 - 2020-02-17 - 15:34:52 -
TWikiGuest
P1076/Ballots
Log In
or
Register
P1076/Ballots Web
Create New Topic
Index
Search
Changes
Notifications
RSS Feed
Statistics
Preferences
Webs
Main
P1076
Ballots
LCS2016_080
P10761
P1647
P16661
P1685
P1734
P1735
P1778
P1800
P1801
Sandbox
TWiki
VIP
VerilogAMS
Copyright © 2008-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback