constant MAX : unsigned(18 downto 0) := "100" & x"0000";
constant MIN : unsigned(18 downto 0) := "001" & x"0000";
这个 VHDL 代码设置最大值和最小值是什么?对定点表示的解释会有所帮助。
constant MAX : unsigned(18 downto 0) := "100" & x"0000";
constant MIN : unsigned(18 downto 0) := "001" & x"0000";
这个 VHDL 代码设置最大值和最小值是什么?对定点表示的解释会有所帮助。
&
运算符连接两个位向量"100"
和x"0000"
(例如,将"00" & "11"
等价于"0011"
)。X"012345689ABCDEF"
语法意味着以下向量应被解释为十六进制数(例如,X"0"
实际上是"0000"
、X"F"
将是"1111"
或X"0F"
将是"00001111"
)。这允许您以更紧凑的方式编写位向量。对于位向量检查的解释,例如http://en.wikipedia.org/wiki/Binary_numeral_system
对于十六进制数字的表示,请检查例如http://en.wikipedia.org/wiki/Hexadecimal
编辑澄清:我假设您使用的是包中的unsigned
类型。numeric_std
从那个包的标题
This package defines numeric types and arithmetic functions
for use with synthesis tools. Two numeric types are defined:
-- > UNSIGNED: represents UNSIGNED number in vector form
-- > SIGNED: represents a SIGNED number in vector form
The base element type is type STD_LOGIC.
The leftmost bit is treated as the most significant bit.
Signed vectors are represented in two's complement form.
所以你MAX
的设置为 2^18,你的设置MIN
为 2^16。