我对组合2号信号有问题。RS232给我发了一个数字4 (8位),然后是5 (8位),加上它是数字45。我的问题是,如何将这些数字4和5与vhdl中的数字45合并成16位信号?另外,我试着计算了两个8位的信号,并调整了大小,但是之后我得到了一个16位的数字9信号。
发布于 2020-11-12 03:53:52
如果你的想法是将两个数字集中在一个单一的信号中,那么类似于状态机的信息可能会对你有所帮助。
process(clk, rst)
begin
if (rst = '1') then
current_state <= FIRST_N;
this_register <= (others => '0');
elsif rising_edge(clk) then
case current_state is
when FIRST_N =>
this_register <= RS232_input * 10;
current_state <= SECOND_N;
when FIRST_N =>
this_register <= RS232_input + this_register;
current_state <= FIRST_N ;
end case;
end if;
end process;像这样的东西能解决你的问题吗?
https://stackoverflow.com/questions/64789913
复制相似问题