大家好!
我想基于几点来实现排序算法:
- 我有一组存储在BRAM中的号码。
这些数字以单精度浮点格式表示,我可以拥有的最大数字是400;
-
电路应该能够读取BRAM中的数字,对它们进行排序并在另一个BRAM中写入已排序的“列表”;
- BRAM只有一个可用于读/写的端口;
所以我对解决这个问题的最佳方法有几点疑问:
- 由于存储在BRAM中的元素数量是可变的,有没有办法动态分配内存来存储我读取的数字?
我能从中获得一些东西吗?
或者,因为我知道数字的最大大小,即使我不使用某些位置,最好有400大小的数组?
- 由于我只有一个端口可用,这意味着我一次只能读一个号码,对吧?
您是否认为阅读整个BRAM更好,进行排序(使用quicksort或mergesort)然后将结果写入其他BRAM?
或者在我从BRAM阅读的同时,我也正在对已读取的数字进行某种排序(例如,插入排序)?
抱歉这些“新手”问题,但我对VHDL很新。
提前致谢。
最好的祝福!
以上来自于谷歌翻译
以下为原文
Hello everyone!
I want to implement a sor
ting algorithm based on a few points:
- I have a set of numbers stored in a BRAM. These numbers are represented in single-precision floating-point format and the maximum numbers that I can have is 400;
- The circuit should be able to read the numbers from the BRAM, sort them and write the sorted "list" in another BRAM;
- The BRAM's only have one port available for reading/writting;
So I'm having a few questions on the best way to approach this problem:
- Since the number of elements stored in the BRAM is variable, is there any way of dynamically allocate memory to store the numbers I read? Do I gain something with this? Or since I know the maximum size of numbers, it is better to have a 400 size array even if I don't use some of its positions?
- Since I only have one port available, this means I can only read one number at a time, right? Do you think it is better to read the whole BRAM, do the sort (with quicksort or mergesort) and then write the result to the other BRAM? Or at the same time I am reading from the BRAM, I'm also doing some sort with the numbers already read (with insertion sort, for example)?
Sorry about these "newbie" questions but I'm quite new to VHDL.
Thanks in advance. Best regards!