TWiki
>
P1076 Web
>
Vhdl2019CollectedRequirements
>
OverloadAssignment
(revision 2) (raw view)
Edit
Attach
---+ Overload Assignment ":=" %TOC% ---++ Proposal Information * Who Updates: Main.JimLewis, Needs Champion * Date Proposed: 2013-10-11 * Date Last Updated: 2013-10-31 * Priority: * Complexity: * Focus: General Language ---++ Tracking proposal for ISAC IR IR2130 [[http://www.eda.org/isac/IRs-VHDL-2002/IR2130.txt]] [[https://bugzilla.mentor.com/show_bug.cgi?id=239][Also see Bugzilla 239]] ---++ Summary This is a generalized implicit conversion that is applied at the highest level of any expression as it is applied to initializations (constant, variable, and signal), variable assignment, signal assignment, parameter map, port map, conditional expressions,... Like the "??" operator, this is only able to be applied at the highest level of an expression. While the IR visualizes this as a procedure, I think it would be better as a function. It could potentially subsume the VHDL-2008 "??" operation. ?Should we alternately consider an implicit cast? ---++ Related Issues: None = General ---++ Competing Issues: None at this time ---++ Use cases ---+++ CASE 1: Implicit Conversions to Integer Based on my memory of old emails, I suspect this is one thing Jonathan had in mind. <verbatim> function ":=" (A: unsigned) return integer is begin return ieee.numeric_std.to_integer (A) ; end function ":=" ; . . . signal ReadIndex : unsigned(5 downto 0) ; type RegBankType is array (63 downto 0) of std_logic_vector(15 downto 0) ; signal RegBank : RegBankType ; . . . ReadData <= RegBank( ReadIndex ) ; </verbatim> Currently what we have to do is: <verbatim>ReadData <= RegBank( to_integer(ReadIndex) ) ; </verbatim> ---+++ CASE 2: Subsume VHDL-2008 "??" operator ---+++ CASE 3: Assigning constants variable x : unsigned(7 downto 0) := 42; <div id="_mcePaste">variable y : ufixed (4 downto -5) := 2.625; -- The assignment procedure could give a warning when a rounding error occurs.</div> <div> </div> <div>-- Rob Gaddi 6/9/2015 -- Where do we use ufixed literals other than 0 and 1 when coding?</div> <div>-- Lieven -- Testbenches</div> <div> </div> ---++ Language impact Initially got an OMG from vendors. Not sure it is worth the effort. While case 1 is nice, it does not occur with a high frequency (like conditionals and the "??" operator does). I think we need either a high frequency use case or many other use cases. ---++ The problem of using functions -- Main.BertDeJong - 2013-10-31 There is a problem in using functions for overloading the assignment operator: When the tool has to choose which overloaded version of a function it should use, it does this based on the types of the arguments and not on the return type. This would mean that the assignment operator could only be overloaded once for each right hand side type. <br />Using procedures instead of functions solves this problem. Another advantage of using procedures is that you can get attribute properties of the target type. -- Main.JimLewis - 2014-10-14 @Bert, function overloading uses return values for overload resolution. See section 4.5.1, p27, of 1076-2008. Or alternately look at the non-standard std_logic_arith, for unsigned operations (such as "+"), it provides both unsigned and std_logic_vector for the result types. -- Main.BrianDrummond - 2013-12-16 Another advantage of procedures is that "Set(X,Y)" already works with no language changes. -- Main.DanielKho - 2014-12-18 I find myself doing lots of explicit type conversions like these, and it will be very helpful if some of these conversions can be made implicit. @Brian, @Bert, can you provide examples on how you would use procedures with the above Cases 1 & 3? Like Jim mentioned, don't we need return values in these cases, which can now only be provided with functions? ---++ Non-supporters _Add your signature here to indicate support for this proposal._ <br />-- Main.JimLewis - 2013-10-11 - I am on the fence, but really need to see other use cases. -- Main.BrianDrummond - 2013-12-05 - I am in the "Assignment is NOT an operator" camp. -- Main.ErnstChristen - 2015-01-21 - Agreed, assignment is different from an operator. ---++ Supporters _Add your signature here to indicate support for this proposal._ -- Main.BertDeJong - 2013-10-31 - If done with procedure -- Main.DanielKho - 2014-12-18 -- Main.PatrickLehmann - 2016-02-19
Edit
|
Attach
|
P
rint version
|
H
istory
:
r12
|
r4
<
r3
<
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r1 - 2020-02-17 - 15:34:36 -
TWikiGuest
P1076
Log In
or
Register
P1076 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-2025 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki?
Send feedback