-
Notifications
You must be signed in to change notification settings - Fork 50
Parmys (Partial Mapper for Yosys) plugin #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
poname
wants to merge
83
commits into
chipsalliance:main
Choose a base branch
from
CAS-Atlantic:parmys-plugin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 24 commits
Commits
Show all changes
83 commits
Select commit
Hold shift + click to select a range
93e53d5
libargparse pugixml
poname 38e19bd
`parmys` plugin
poname d43f15c
ISC license
poname d043671
vtr licensing
poname e7cc4b8
ci
poname c2fbe0d
Revert "ci"
poname a900beb
all together
poname 2ec748d
visualization
poname 9cbd08f
block mem bug
poname b390300
warning
poname 2c0ef3d
ci
poname 1c35cd5
eltwiselayer rm
poname 1751c43
eltwise_layer.v symlink
poname dd4e2fe
ci
poname cb5432a
rm files
poname 26d3372
files symlink
poname 4503b03
primitives symlink
poname ddd1cc2
ci
poname 736593c
VexRiscv_Lite test
poname 38d0795
ci
poname ba3bc5c
finalized
poname 2d03233
mips32r1_core submodule added
poname c24e691
mips32r1_core test added
poname 8277a06
all together
poname 4fe1f8f
no libargparse
poname 03b7b79
licensing resolved
poname 30cc0de
Pr issues (#1)
poname 608b352
Vtr dir (#2)
poname f46b99c
Merge branch 'chipsalliance:main' into parmys-plugin
poname cfd6c83
g++-11
poname 714e583
g++ v
poname 2b4bfa1
try vtr-optimized
poname c3c9372
vtr
poname 6310dfe
vtr-libs test
poname 4197e32
typo
poname 5beb999
ci
poname a237d28
ci 2
poname 3226dce
no vtr
poname 2a908e4
vtr-gui
poname 7b36c74
vtr
poname 54f5f0f
yosys
poname ef6aaa6
retry
poname 1692770
#2
poname 9d14767
Merge branch 'chipsalliance:main' into lto-issue
poname 5ef45cd
dash
poname ab0c502
check#3
poname 405d737
Merge remote-tracking branch 'origin/lto-issue' into lto-issue
poname 55bacdc
-lrtlnumber
poname 0a3130a
symlink fixed
poname 7da8d01
smoke test
poname b9739df
no smoke
poname 7dd1c1a
cas-atlantic::vtr-libs
poname 9d3662a
Merge branch 'chipsalliance:main' into parmys-plugin
poname 6d94ece
cleaned
poname f1ff515
Merge branch 'lto-issue' into parmys-plugin
poname 4ea5bde
all together
poname b1617f1
Merge branch 'chipsalliance:main' into parmys-plugin
poname 37f9b11
Merge branch 'chipsalliance:main' into parmys-plugin
poname 528d631
Merge branch 'chipsalliance:main' into parmys-plugin
poname 7c983b7
Merge branch 'main' into parmys-plugin
poname c9f1f6c
parmys added to ci
poname 1f934cb
Merge branch 'chipsalliance:main' into parmys-plugin
poname d9c6653
Merge branch 'chipsalliance:main' into parmys-plugin
poname f2d60ba
code re-order
poname c697777
done!
poname 8352c5d
format check
poname 504ef2e
all
poname 80befb9
Merge branch 'chipsalliance:main' into parmys-plugin
poname 6d74e34
Merge branch 'chipsalliance:main' into parmys-plugin
poname ec38226
Merge branch 'chipsalliance:main' into parmys-plugin
poname 2e0ac37
Merge branch 'chipsalliance:main' into parmys-plugin
poname 9507665
Merge branch 'chipsalliance:main' into parmys-plugin
poname 130ac1d
Merge branch 'chipsalliance:main' into parmys-plugin
poname ed564a5
Merge branch 'chipsalliance:main' into parmys-plugin
poname 0e33db1
Merge branch 'chipsalliance:main' into parmys-plugin
poname 000cdf8
Merge branch 'main' into parmys-plugin
poname cc380b0
Merge branch 'chipsalliance:main' into parmys-plugin
poname d59c839
Merge branch 'chipsalliance:main' into parmys-plugin
poname 619d00b
Merge branch 'chipsalliance:main' into parmys-plugin
poname e1ca934
Merge branch 'chipsalliance:main' into parmys-plugin
poname e71088c
Merge branch 'chipsalliance:main' into parmys-plugin
poname 87fb759
Merge branch 'chipsalliance:main' into parmys-plugin
poname 8d5cfaf
Merge branch 'chipsalliance:main' into parmys-plugin
poname File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| # Copyright 2022 Daniel Khadivi | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| PLUGIN_DIR := $(abspath $(dir $(lastword $(MAKEFILE_LIST)))) | ||
|
|
||
| NAME = parmys | ||
| SOURCES = parmys.cc \ | ||
| parmys_arch.cc \ | ||
| parmys_update.cc \ | ||
| parmys_utils.cc \ | ||
| parmys_resolve.cc \ | ||
| src/adders.cc \ | ||
| src/enum_str.cc \ | ||
| src/MixingOptimization.cc \ | ||
| src/read_xml_config_file.cc \ | ||
| src/odin_error.cc \ | ||
| src/odin_util.cc \ | ||
| src/netlist_statistic.cc \ | ||
| src/netlist_utils.cc \ | ||
| src/netlist_check.cc \ | ||
| src/netlist_cleanup.cc \ | ||
| src/node_creation_library.cc \ | ||
| src/multipliers.cc \ | ||
| src/subtractions.cc \ | ||
| src/HardSoftLogicMixer.cc \ | ||
| src/odin_ii.cc \ | ||
| src/string_cache.cc \ | ||
| src/partial_map.cc \ | ||
| src/hard_blocks.cc \ | ||
| src/BlockMemories.cc \ | ||
| src/memories.cc \ | ||
| src/netlist_visualizer.cc \ | ||
| src/Hashtable.cc \ | ||
| src/ast_util.cc \ | ||
| ../third_party/vtr/libs/vtrutil/src/vtr_util.cc \ | ||
| ../third_party/vtr/libs/vtrutil/src/vtr_token.cc \ | ||
| ../third_party/vtr/libs/vtrutil/src/vtr_memory.cc \ | ||
| ../third_party/vtr/libs/vtrutil/src/vtr_list.cc \ | ||
| ../third_party/vtr/libs/vtrutil/src/vtr_log.cc \ | ||
| ../third_party/vtr/libs/vtrutil/src/vtr_expr_eval.cc \ | ||
| ../third_party/vtr/libs/vtrutil/src/vtr_digest.cc \ | ||
| ../third_party/vtr/libs/vtrutil/src/vtr_math.cc \ | ||
| ../third_party/vtr/libs/vtrutil/src/vtr_path.cc \ | ||
| ../third_party/vtr/libs/vtrutil/src/vtr_assert.cc \ | ||
| ../third_party/vtr/libs/log/src/log.cc \ | ||
| ../third_party/pugixml/src/pugixml.cpp \ | ||
| ../third_party/libargparse/src/argparse.cpp \ | ||
| ../third_party/libargparse/src/argparse_formatter.cpp \ | ||
| ../third_party/libargparse/src/argparse_util.cpp \ | ||
| ../third_party/vtr/libs/rtlnumber/src/rtl_int.cc \ | ||
| ../third_party/vtr/libs/rtlnumber/src/rtl_utils.cc \ | ||
| ../third_party/vtr/libs/pugiutil/src/pugixml_loc.cc \ | ||
| ../third_party/vtr/libs/pugiutil/src/pugixml_util.cc \ | ||
| ../third_party/vtr/libs/archfpga/src/physical_types.cc \ | ||
| ../third_party/vtr/libs/archfpga/src/read_xml_util.cc \ | ||
| ../third_party/vtr/libs/archfpga/src/arch_error.cc \ | ||
| ../third_party/vtr/libs/archfpga/src/physical_types_util.cc \ | ||
| ../third_party/vtr/libs/archfpga/src/arch_check.cc \ | ||
| ../third_party/vtr/libs/archfpga/src/arch_util.cc \ | ||
| ../third_party/vtr/libs/archfpga/src/read_xml_arch_file.cc \ | ||
| ../third_party/vtr/libs/archfpga/src/parse_switchblocks.cc \ | ||
| ../third_party/vtr/libs/archfpga/src/echo_arch.cc | ||
|
|
||
| include ../Makefile_plugin.common | ||
|
|
||
| CXXFLAGS += -I./include | ||
| CXXFLAGS += -I../third_party/pugixml/src | ||
| CXXFLAGS += -I../third_party/libargparse/src | ||
| CXXFLAGS += -I../third_party/vtr/libs/archfpga/src | ||
| CXXFLAGS += -I../third_party/vtr/libs/log/src | ||
| CXXFLAGS += -I../third_party/vtr/libs/pugiutil/src | ||
| CXXFLAGS += -I../third_party/vtr/libs/rtlnumber/src/include | ||
| CXXFLAGS += -I../third_party/vtr/libs/rtlnumber/src | ||
| CXXFLAGS += -I../third_party/vtr/libs/vtrutil/src | ||
| CXXFLAGS += -I../third_party/vtr/libs/vpr/src/draw | ||
|
|
||
| CXXSTD := c++14 | ||
| CXXFLAGS += -std=$(CXXSTD) -Os | ||
|
|
||
| LDLIBS += -lpthread | ||
|
|
||
| TECHLIBS_DIR = techlibs | ||
| VERILOG_MODULES = adff2dff.v \ | ||
| adffe2dff.v \ | ||
| aldff2dff.v \ | ||
| aldffe2dff.v \ | ||
| vtr_primitives.v | ||
|
|
||
| # install_modules: $(VERILOG_MODULES) | ||
| # install -D $< $(YOSYS_PLUGINS_DIR)/parmys/$< | ||
| install_modules: | ||
| $(foreach f, $(wildcard $(TECHLIBS_DIR)/*), install -D $(f) $(YOSYS_DATA_DIR)/parmys/$(notdir $(f));) | ||
|
|
||
| install: install_modules | ||
|
|
||
| clean_modules: | ||
| rm -rf ./third_party | ||
|
|
||
| clean: clean_modules |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| /** | ||
| * Copyright (c) 2021 Seyed Alireza Damghani ([email protected]) | ||
| * | ||
| * Permission is hereby granted, free of charge, to any person | ||
| * obtaining a copy of this software and associated documentation | ||
| * files (the "Software"), to deal in the Software without | ||
| * restriction, including without limitation the rights to use, | ||
| * copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the | ||
| * Software is furnished to do so, subject to the following | ||
| * conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be | ||
| * included in all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
| * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
| * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
| * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| * OTHER DEALINGS IN THE SOFTWARE. | ||
| * | ||
| * @file This file includes the definition of the basic structure | ||
| * used in Odin-II Block Memory resolving process. Moreover, it | ||
| * provides the declaration of the related public routines. | ||
| */ | ||
| #ifndef _BLOCK_MEMORIES_H_ | ||
| #define _BLOCK_MEMORIES_H_ | ||
|
|
||
| #include <unordered_map> | ||
|
|
||
| // Max number of bits for register of array inference | ||
| const int LUTRAM_INFERENCE_THRESHOLD_MIN = 80; // Max number of bits for LUTRAM inference | ||
| const int LUTRAM_INFERENCE_THRESHOLD_MAX = 640; // Min number of bits for LUTRAM inference | ||
|
|
||
| /* | ||
| * Contains a pointer to the block memory node as well as other | ||
| * information which is used in creating the block memory. | ||
| */ | ||
| struct block_memory_t { | ||
| loc_t loc; | ||
| nnode_t *node; | ||
|
|
||
| signal_list_t *read_addr; | ||
| signal_list_t *read_data; | ||
| signal_list_t *read_en; | ||
|
|
||
| signal_list_t *write_addr; | ||
| signal_list_t *write_data; | ||
| signal_list_t *write_en; | ||
|
|
||
| signal_list_t *clk; | ||
|
|
||
| char *name; | ||
| char *memory_id; | ||
| }; | ||
|
|
||
| typedef std::unordered_map<std::string, block_memory_t *> block_memory_hashtable; | ||
|
|
||
| /** | ||
| * block memories information. variable will be invalid | ||
| * after iterations happen before partial mapping | ||
| */ | ||
| struct block_memory_information_t { | ||
| /** | ||
| * block_memory_list and read-only_memory_list linked lists | ||
| * include the corresponding memory instances. Each instance | ||
| * comprises memory signal lists, location, memory id and the | ||
| * corresponding netlist node. These linked lists are used in | ||
| * optimization iteration, including signal pruning, REG/LUTRAM | ||
| * threshold checking and mapping to VTR memory blocks. Once the | ||
| * optimization iteration is done, these linked lists are not | ||
| * valid anymore. | ||
| * | ||
| * [NOTE] Block memories and read-only memory both use the same | ||
| * structure (block_memory_t*). They only differ in terms of | ||
| * their member variables initialization. The naming convention | ||
| * is only due to the ease of the coding process. | ||
| */ | ||
| vtr::t_linked_vptr *block_memory_list; | ||
| vtr::t_linked_vptr *read_only_memory_list; | ||
| /* hashtable to look up block memories faster */ | ||
| block_memory_hashtable block_memories; | ||
| block_memory_hashtable read_only_memories; | ||
| }; | ||
| extern block_memory_information_t block_memories_info; | ||
|
|
||
| extern void init_block_memory_index(); | ||
| extern void free_block_memories(); | ||
|
|
||
| extern void resolve_ymem_node(nnode_t *node, uintptr_t traverse_mark_number, netlist_t *netlist); | ||
| extern void resolve_ymem2_node(nnode_t *node, uintptr_t traverse_mark_number, netlist_t *netlist); | ||
| extern void resolve_bram_node(nnode_t *node, uintptr_t traverse_mark_number, netlist_t *netlist); | ||
| extern void resolve_rom_node(nnode_t *node, uintptr_t traverse_mark_number, netlist_t *netlist); | ||
|
|
||
| extern void iterate_block_memories(netlist_t *netlist); | ||
|
|
||
| #endif // _BLOCK_MEMORIES_H_ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| /* | ||
| * Permission is hereby granted, free of charge, to any person | ||
| * obtaining a copy of this software and associated documentation | ||
| * files (the "Software"), to deal in the Software without | ||
| * restriction, including without limitation the rights to use, | ||
| * copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| * copies of the Software, and to permit persons to whom the | ||
| * Software is furnished to do so, subject to the following | ||
| * conditions: | ||
| * | ||
| * The above copyright notice and this permission notice shall be | ||
| * included in all copies or substantial portions of the Software. | ||
| * | ||
| * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
| * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | ||
| * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
| * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
| * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | ||
| * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
| * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR | ||
| * OTHER DEALINGS IN THE SOFTWARE. | ||
| */ | ||
|
|
||
| #ifndef HARD_SOFT_LOGIC_MIXER_HPP | ||
| #define HARD_SOFT_LOGIC_MIXER_HPP | ||
|
|
||
| #include "MixingOptimization.hpp" | ||
| #include "odin_types.h" // netlist_t, config_t | ||
|
|
||
| class HardSoftLogicMixer | ||
| { | ||
| public: | ||
| HardSoftLogicMixer(); | ||
| ~HardSoftLogicMixer(); | ||
| /*---------------------------------------------------------------------- | ||
| * Returns whether the specific node is a candidate for implementing | ||
| * in hard block | ||
| *--------------------------------------------------------------------- | ||
| */ | ||
| bool hardenable(nnode_t *node); | ||
|
|
||
| /*---------------------------------------------------------------------- | ||
| * Function: map_deferred_blocksQueries if mixing optimization is enabled for this kind of | ||
| * of hard blocks | ||
| *--------------------------------------------------------------------- | ||
| */ | ||
| bool enabled(nnode_t *node); | ||
|
|
||
| /*---------------------------------------------------------------------- | ||
| * Function: perform_optimizations | ||
| * For all noted nodes, that were noted as candidates to be implemented | ||
| * on the hard blocks, launches corresponding procedure of chosing the | ||
| * corresponding blocks | ||
| * Parameters: netlist_t * | ||
| *--------------------------------------------------------------------- | ||
| */ | ||
| void perform_optimizations(netlist_t *netlist); | ||
|
|
||
| /*---------------------------------------------------------------------- | ||
| * Function: partial_map_node | ||
| * High-level call to provide support for partial mapping layer | ||
| * Parameters: | ||
| * node_t * : pointer to node needs to perform mapping | ||
| * netlist_t : pointer to netlist | ||
| *--------------------------------------------------------------------- | ||
| */ | ||
| void partial_map_node(nnode_t *node, short traverse_number, netlist_t *); | ||
|
|
||
| /*---------------------------------------------------------------------- | ||
| * Function: note_candidate_node | ||
| * Calculates number of available hard blocks by issuing a call, | ||
| * traverses the netlist and statistics to figure out | ||
| * which operation should be implemented on the hard block | ||
| * Parameters: | ||
| * node_t * : pointer to candidate node | ||
| *--------------------------------------------------------------------- | ||
| */ | ||
| void note_candidate_node(nnode_t *node); | ||
|
|
||
| // This is a container containing all optimization passes | ||
| MixingOpt *_opts[operation_list_END]; | ||
|
|
||
| private: | ||
| /*---------------------------------------------------------------------- | ||
| * Function: hard_blocks_needed | ||
| * Returns cached value calculated from netlist, for a specific optimiza | ||
| * tion kind | ||
| *--------------------------------------------------------------------- | ||
| */ | ||
| int hard_blocks_needed(operation_list); | ||
|
|
||
| // This array is composed of vectors, that store nodes that | ||
| // are potential candidates for performing mixing optimization | ||
| std::vector<nnode_t *> _nodes_by_opt[operation_list_END]; | ||
| }; | ||
|
|
||
| #endif |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.