如何在VHDL中高效地相加几个二进制数?

问题描述 投票:0回答:0

我试着用谷歌搜索这个但是每个结果都显示常规的 std_logic 实现我有点迷路了。我的教授分配了这个任务,要求将二进制数添加为输入 A 和 B。有人有这方面的经验吗?

到目前为止,这是我的示例代码:

ENTITY fig12 IS
    PORT(
    a1      : IN std_logic
    b1    : IN std_logic;
    cin   : OUT std_logic
    sun1  : OUT std_logic
    cout  : OUT std_logic ;
    );
END fig12;
ARCHITECTURE arc OF fig12 IS
BEGIN
    cout<= (a1 AND b1) OR (a1 AND cin) OR (b1 and cin);
    sun1<=(a1 XOR b1) XOR cin;
END arc;
vhdl
© www.soinside.com 2019 - 2024. All rights reserved.