﻿<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="thpdoc.xsl"?>
<page id="__bin" suffix=" Function">
  <subsection>Explicitly defines a logic vector constant.</subsection>
  <code>logic[] __bin(string value);</code>
  The <kw>__bin</kw>() function allows explicitly defining logic vector constants using their binary representation. It is useful in conjunction with type inference and for declaring large constants (larger than 32 bits).
  <section name="Remarks">
  <p>Note that you can initialize vectors of size 32 and less with normal C++ style integral constants (e.g. 15, 0xF or 0b1111).</p>
  </section>
  <examples>
	<example>
		<code>entity Test
{
	signal auto xxx = __bin("010"), yyy = 0b010;
	signal logic[4] xx2 = __bin("0010"), yy2 = 0b010;
}</code>
	Generated VHDL code:
<code>	signal xxx : std_logic_vector(2 downto 0) := B"010";
	signal yyy : integer := 2;
	signal xx2 : std_logic_vector(3 downto 0) := X"2";
	signal yy2 : std_logic_vector(3 downto 0) := X"2";</code>
	</example>
  </examples>
  <seealso id="const"/>
  <seealso id="__hex"/>
</page>