| | |-----Ursprüngliche Nachricht----- |Von: owner-vhdl-200x@eda.org [mailto:owner-vhdl-200x@eda.org] Im Auftrag von Colin Paul Gloster |Gesendet: Donnerstag, 20. Dezember 2012 13:07 |An: vhdl-200x@eda.org |Betreff: Re: [vhdl-200x] Support for hex, octal, binary in places where integers can be used | |On December 20th, 2012, Martin Stolpe emailed: ||------------------------------------------------------------------------| ||"Hello, | || | ||currently VHDL doesn't seem to support a construct which allows the | ||usage of hex numbers instead of integer numbers. For example sometimes | ||I encode my addresses like this: | || | ||CONSTANT | || C_ADDRESS_WIDTH | || : integer := 4; | || | ||CONSTANT | || C_READ_DATA | || : unsigned(C_ADDRESS_WIDTH - 1 DOWNTO 0) := | || to_unsigned(1, C_ADDRESS_WIDTH); | || | ||it would be nice if I could write it like this or something similar: | || | ||CONSTANT | || C_ADDRESS_WIDTH | || : integer := 12; | || | ||CONSTANT | || C_READ_DATA | || : unsigned(C_ADDRESS_WIDTH - 1 DOWNTO 0) := | || to_unsigned(0x1, C_ADDRESS_WIDTH); | || ||| This way if I have to adjust the address width there would be just one | ||position in the code which I would have to modify. The hexadecimal | ||coding would be more in line with the address encoding the | ||microcontroller programmers use. Other suggestions would be welcomed | ||though. | || | || | ||Best regards | ||i.A. Martin Stolpe | || | || ||| ||----------------------------------------------------------------------- | || | ||Systemingenieur | ||R&D Smart Embedded Systems (SW) | || | ||NewTec GmbH | ||System-Entwicklung und Beratung | ||Heinrich-von-Stephan-Str. 8B | ||D-79100 Freiburg | || | ||Telefon : +49 (0) 761 21117-40 | ||Telefax : +49 (0) 761 21117-41 | ||email : martin.stolpe@newtec.de | ||web : http://www.newtec.de | || ||| ||------------------------------------------------------------------------| ||Geschäftsführer: Johannes Werbach, Harald Molle, Ulrich Schwer, | ||Michael Tröscher | ||Registergericht: Memmingen - HRB 7236 USt.-IdNr. DE130850199 | ||------------------------------------------------------------------------| || | || | || | ||-- This message has been scanned for viruses and dangerous content by | || MailScanner, and is believed to be clean." | ||------------------------------------------------------------------------| | |Dear Mr. Stolpe: | |VHDL already supports hexadecimal; decimal; octal; binary; and other bases. | |Subsubsubsection 15.5.3 Based literals |of IEEE Std 1076-2008 |contains some examples: |-- Integer literals of value 255: | 2#1111_1111# 16#FF# 016#0FF# |-- Integer literals of value 224: | 16#E#E1 2#1110_0000# |-- Real literals of value 4095.0: | 16#F.FF#E+2 2#1.1111_1111_111#E11 | | |Furthermore, |Subsubsection 15.8 Bit string literals |shows that "111111111111" is equivalent to B"1111_1111_1111". So if we have a fourteen-bit value and a fifteen-bit value, we could tell at a glance that they are of different lengths by looking at B"11_1111_1111_0000" and B"111_1111_1111_0000". | |It may be worthwhile getting some tips from a book such as "The Designer's Guide to VHDL", WWW.Eason.Ie/look/9780120887859/Designer-s-Guide-to-VHDL/Peter-Ashenden |and |WWW.ElsevierDirect.com/product.jsp?isbn=9780120887859 |and |WWW.Ashenden.com.Au/vhdl-book/DG3E.html |or if you can not get hold of that, then maybe "Digital Design: An Embedded Systems Approach Using VHDL", http://textbooks.Elsevier.com/web/product_details.aspx?isbn=9780123695284&Search=9780123695284&SearchCriteria=Keyword | |Yours sincerely, |Paul Colin Gloster | |-- |This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. Hello Mr Gloster thanks a lot for the examples! I didn't know the term I needed to look for. The only examples I've found were about the representations of bit vector literals. Best regards Martin Stolpe -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Thu Dec 20 07:08:58 2012
This archive was generated by hypermail 2.1.8 : Thu Dec 20 2012 - 07:08:59 PST