0

My codeI am a new at vhdl and i have to multiplication two unsigned vectors like we all did in high scool

so i wrote the program and it dose compile but the result is not good.

The logic looks ok but still it dose not work can any one help. I could not get how to place code here so please see the image attached.

Thx

4

1 回答 1

2

在编写 VHDL 时,您首先需要考虑硬件。尽管各种语句可能看起来与您从其他语言中知道的相似,但其中许多语句的行为不同,因为它们被映射到硬件并并行而不是按顺序进行评估。

例如,forVHDL 中的循环不会遍历循环,而是复制循环内容并并行评估所有这些内容。所以你积累的想法是temp行不通的,因为所有的值都temp1将同时可用,而不是一个接一个。

处理乘法的简单方法是只使用*运算符,因为许多合成器会选择它并自动实例化必要的硬件。我认为这是某种形式的练习,您需要自己实现功能 - 所以只需 for放弃循环并将中间结果存储在它们自己的变量中,然后最后将它们全部加起来。

于 2012-05-18T07:50:47.677 回答