vhdl - VHDL:整数到 std_logic_vector 转换的问题
问题描述
在我的代码int_mm_add
中被定义为 aninteger
并且mm_add
被定义为std_logic_vector(13 downto 0)
.
我尝试使用以下方法从整数转换为 std_logic_vector:
mm_add <= std_logic_vector(to_unsigned(int_mm_add, mm_add'length));
int_mm_add
是使用其他一些信号计算得出的。整数计算似乎有效,但转换无效,例如在模拟时:
int_mm_add = 1 converts to mm_add = "0000000000000X"
int_mm_add = 2 converts to mm_add = "000000000000X0"
附上我认为相关的代码部分和波形快照:
- 在这里,我尝试将计算直接移动到转换函数中,而不是转换
int_mm_add
,这会使转换被时钟延迟:
process(clk, rst)
begin
if rst = '1' then
"something"
elsif rising_edge(clk) then
int_mm_add <= ((v_cnt / 8) * (2**8)) + (h_cnt / 8);
mm_add <= std_logic_vector(to_unsigned(((v_cnt / 8) * (2**8)) + (h_cnt / 8), mm_add'length));
end if;
end process;
解决方案
推荐阅读
- quasar-framework - 如何以“类星体方式”居中输入
- python - 卡在 Python 目录中
- python - 搜索结果未显示
- android - 表格行内 TextView 的第二行不是真正的文本对齐,但第一行没问题
- java - 整数 n 作为 List 的第二个参数传递
.sublist(fromIndex, toIndex),但堆栈跟踪说 toIndex 在 Kotlin 中是 n + 2 - python - 使用请求库登录到 parscoders.com
- powershell - 使用invoke-restmethod的powershell POST数据问题
- javascript - node.js中的包和模块有什么区别
- javascript - 如何在使用 Puppeteer 评估页面响应之前使表单页面元素加载其内部文本?
- excel - 复制特定范围