Skip to content

Commit 6361983

Browse files
Reversed the order of models in parmys to fix slightly different results
1 parent b985f0f commit 6361983

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

parmys/parmys-plugin/core/hard_block.cc

+15-2
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
*
1616
* SPDX-License-Identifier: Apache-2.0
1717
*/
18+
#include <algorithm>
1819
#include <stdlib.h>
1920

2021
#include "hard_block.h"
@@ -55,7 +56,13 @@ t_model_ports *get_model_port(t_model_ports *ports, const char *name)
5556
void cache_hard_block_names()
5657
{
5758
hard_block_names = sc_new_string_cache();
58-
for (LogicalModelId model_id : Arch.models.user_models()) {
59+
// After a change to the construction of the user models, the order was
60+
// reversed, which slightly changed the results. Reversing them back to
61+
// attain the same results.
62+
// TODO: Regenerate the golden solutions to use the new model order.
63+
std::vector<LogicalModelId> user_models(Arch.models.user_models().begin(), Arch.models.user_models().end());
64+
std::reverse(user_models.begin(), user_models.end());
65+
for (LogicalModelId model_id : user_models) {
5966
t_model* hard_blocks = &Arch.models.get_model(model_id);
6067
int sc_spot = sc_add_string(hard_block_names, hard_blocks->name);
6168
hard_block_names->data[sc_spot] = (void *)hard_blocks;
@@ -195,7 +202,13 @@ void output_hard_blocks_yosys(Yosys::Design *design)
195202
{
196203
t_model_ports *hb_ports;
197204

198-
for (LogicalModelId model_id : Arch.models.user_models()) {
205+
// After a change to the construction of the user models, the order was
206+
// reversed, which slightly changed the results. Reversing them back to
207+
// attain the same results.
208+
// TODO: Regenerate the golden solutions to use the new model order.
209+
std::vector<LogicalModelId> user_models(Arch.models.user_models().begin(), Arch.models.user_models().end());
210+
std::reverse(user_models.begin(), user_models.end());
211+
for (LogicalModelId model_id : user_models) {
199212
t_model* hard_blocks = &Arch.models.get_model(model_id);
200213
if (hard_blocks->used == 1) /* Hard Block is utilized */
201214
{

parmys/parmys-plugin/parmys_arch.cc

+7-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,13 @@ struct ParmysArchPass : public Pass {
120120
const char *arch_info_file = "arch.info";
121121
EchoArch(arch_info_file, physical_tile_types, logical_block_types, &arch);
122122

123-
for (LogicalModelId model_id : arch.models.user_models()) {
123+
// After a change to the construction of the user models, the order was
124+
// reversed, which slightly changed the results. Reversing them back to
125+
// attain the same results.
126+
// TODO: Regenerate the golden solutions to use the new model order.
127+
std::vector<LogicalModelId> user_models(arch.models.user_models().begin(), arch.models.user_models().end());
128+
std::reverse(user_models.begin(), user_models.end());
129+
for (LogicalModelId model_id : user_models) {
124130
t_model* hb = &arch.models.get_model(model_id);
125131
if (strcmp(hb->name, SINGLE_PORT_RAM_string) && strcmp(hb->name, DUAL_PORT_RAM_string) && strcmp(hb->name, "multiply") &&
126132
strcmp(hb->name, "adder")) {

0 commit comments

Comments
 (0)