mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-03 21:09:12 +00:00 
			
		
		
		
	Merge remote-tracking branch 'origin/master' into xc7mux
This commit is contained in:
		
						commit
						1e201a9b01
					
				
					 39 changed files with 1006 additions and 794 deletions
				
			
		| 
						 | 
					@ -16,7 +16,11 @@ Yosys 0.8 .. Yosys 0.8-dev
 | 
				
			||||||
    - Added "gate2lut.v" techmap rule
 | 
					    - Added "gate2lut.v" techmap rule
 | 
				
			||||||
    - Added "rename -src"
 | 
					    - Added "rename -src"
 | 
				
			||||||
    - Added "equiv_opt" pass
 | 
					    - Added "equiv_opt" pass
 | 
				
			||||||
 | 
					<<<<<<< HEAD
 | 
				
			||||||
    - Added "muxpack" pass
 | 
					    - Added "muxpack" pass
 | 
				
			||||||
 | 
					=======
 | 
				
			||||||
 | 
					    - Added "read_aiger" frontend
 | 
				
			||||||
 | 
					>>>>>>> origin/master
 | 
				
			||||||
    - "synth_xilinx" to now infer hard shift registers, using new "shregmap -tech xilinx"
 | 
					    - "synth_xilinx" to now infer hard shift registers, using new "shregmap -tech xilinx"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load diff
											
										
									
								
							| 
						 | 
					@ -42,6 +42,7 @@ struct AigerReader
 | 
				
			||||||
    std::vector<RTLIL::Wire*> inputs;
 | 
					    std::vector<RTLIL::Wire*> inputs;
 | 
				
			||||||
    std::vector<RTLIL::Wire*> latches;
 | 
					    std::vector<RTLIL::Wire*> latches;
 | 
				
			||||||
    std::vector<RTLIL::Wire*> outputs;
 | 
					    std::vector<RTLIL::Wire*> outputs;
 | 
				
			||||||
 | 
					    std::vector<RTLIL::Wire*> bad_properties;
 | 
				
			||||||
    std::vector<RTLIL::Cell*> boxes;
 | 
					    std::vector<RTLIL::Cell*> boxes;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    AigerReader(RTLIL::Design *design, std::istream &f, RTLIL::IdString module_name, RTLIL::IdString clk_name, std::string map_filename, bool wideports);
 | 
					    AigerReader(RTLIL::Design *design, std::istream &f, RTLIL::IdString module_name, RTLIL::IdString clk_name, std::string map_filename, bool wideports);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -154,6 +154,7 @@ std::string AST::type2str(AstNodeType type)
 | 
				
			||||||
	X(AST_GENIF)
 | 
						X(AST_GENIF)
 | 
				
			||||||
	X(AST_GENCASE)
 | 
						X(AST_GENCASE)
 | 
				
			||||||
	X(AST_GENBLOCK)
 | 
						X(AST_GENBLOCK)
 | 
				
			||||||
 | 
						X(AST_TECALL)
 | 
				
			||||||
	X(AST_POSEDGE)
 | 
						X(AST_POSEDGE)
 | 
				
			||||||
	X(AST_NEGEDGE)
 | 
						X(AST_NEGEDGE)
 | 
				
			||||||
	X(AST_EDGE)
 | 
						X(AST_EDGE)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -137,6 +137,7 @@ namespace AST
 | 
				
			||||||
		AST_GENIF,
 | 
							AST_GENIF,
 | 
				
			||||||
		AST_GENCASE,
 | 
							AST_GENCASE,
 | 
				
			||||||
		AST_GENBLOCK,
 | 
							AST_GENBLOCK,
 | 
				
			||||||
 | 
							AST_TECALL,
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		AST_POSEDGE,
 | 
							AST_POSEDGE,
 | 
				
			||||||
		AST_NEGEDGE,
 | 
							AST_NEGEDGE,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1575,6 +1575,37 @@ RTLIL::SigSpec AstNode::genRTLIL(int width_hint, bool sign_hint)
 | 
				
			||||||
			delete always;
 | 
								delete always;
 | 
				
			||||||
		} break;
 | 
							} break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						case AST_TECALL: {
 | 
				
			||||||
 | 
								int sz = children.size();
 | 
				
			||||||
 | 
								if (str == "$info") {
 | 
				
			||||||
 | 
									if (sz > 0)
 | 
				
			||||||
 | 
										log_file_info(filename, linenum, "%s.\n", children[0]->str.c_str());
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										log_file_info(filename, linenum, "\n");
 | 
				
			||||||
 | 
								} else if (str == "$warning") {
 | 
				
			||||||
 | 
									if (sz > 0)
 | 
				
			||||||
 | 
										log_file_warning(filename, linenum, "%s.\n", children[0]->str.c_str());
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										log_file_warning(filename, linenum, "\n");
 | 
				
			||||||
 | 
								} else if (str == "$error") {
 | 
				
			||||||
 | 
									if (sz > 0)
 | 
				
			||||||
 | 
										log_file_error(filename, linenum, "%s.\n", children[0]->str.c_str());
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										log_file_error(filename, linenum, "\n");
 | 
				
			||||||
 | 
								} else if (str == "$fatal") {
 | 
				
			||||||
 | 
									// TODO: 1st parameter, if exists, is 0,1 or 2, and passed to $finish()
 | 
				
			||||||
 | 
									// if no parameter is given, default value is 1
 | 
				
			||||||
 | 
									// dollar_finish(sz ? children[0] : 1);
 | 
				
			||||||
 | 
									// perhaps create & use log_file_fatal()
 | 
				
			||||||
 | 
									if (sz > 0)
 | 
				
			||||||
 | 
										log_file_error(filename, linenum, "FATAL: %s.\n", children[0]->str.c_str());
 | 
				
			||||||
 | 
									else
 | 
				
			||||||
 | 
										log_file_error(filename, linenum, "FATAL.\n");
 | 
				
			||||||
 | 
								} else {
 | 
				
			||||||
 | 
									log_file_error(filename, linenum, "Unknown elabortoon system task '%s'.\n", str.c_str());
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							} break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	case AST_FCALL: {
 | 
						case AST_FCALL: {
 | 
				
			||||||
			if (str == "\\$anyconst" || str == "\\$anyseq" || str == "\\$allconst" || str == "\\$allseq")
 | 
								if (str == "\\$anyconst" || str == "\\$anyseq" || str == "\\$allconst" || str == "\\$allseq")
 | 
				
			||||||
			{
 | 
								{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -311,6 +311,11 @@ supply1 { return TOK_SUPPLY1; }
 | 
				
			||||||
	return TOK_ID;
 | 
						return TOK_ID;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					"$"(info|warning|error|fatal) {
 | 
				
			||||||
 | 
						frontend_verilog_yylval.string = new std::string(yytext);
 | 
				
			||||||
 | 
						return TOK_ELAB_TASK;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
"$signed"   { return TOK_TO_SIGNED; }
 | 
					"$signed"   { return TOK_TO_SIGNED; }
 | 
				
			||||||
"$unsigned" { return TOK_TO_UNSIGNED; }
 | 
					"$unsigned" { return TOK_TO_UNSIGNED; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -133,7 +133,7 @@ struct specify_rise_fall {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
%token <string> TOK_STRING TOK_ID TOK_CONSTVAL TOK_REALVAL TOK_PRIMITIVE
 | 
					%token <string> TOK_STRING TOK_ID TOK_CONSTVAL TOK_REALVAL TOK_PRIMITIVE
 | 
				
			||||||
%token <string> TOK_SVA_LABEL TOK_SPECIFY_OPER
 | 
					%token <string> TOK_SVA_LABEL TOK_SPECIFY_OPER TOK_ELAB_TASK
 | 
				
			||||||
%token TOK_ASSERT TOK_ASSUME TOK_RESTRICT TOK_COVER TOK_FINAL
 | 
					%token TOK_ASSERT TOK_ASSUME TOK_RESTRICT TOK_COVER TOK_FINAL
 | 
				
			||||||
%token ATTR_BEGIN ATTR_END DEFATTR_BEGIN DEFATTR_END
 | 
					%token ATTR_BEGIN ATTR_END DEFATTR_BEGIN DEFATTR_END
 | 
				
			||||||
%token TOK_MODULE TOK_ENDMODULE TOK_PARAMETER TOK_LOCALPARAM TOK_DEFPARAM
 | 
					%token TOK_MODULE TOK_ENDMODULE TOK_PARAMETER TOK_LOCALPARAM TOK_DEFPARAM
 | 
				
			||||||
| 
						 | 
					@ -1557,6 +1557,15 @@ cell_port:
 | 
				
			||||||
		astbuf2->children.push_back(node);
 | 
							astbuf2->children.push_back(node);
 | 
				
			||||||
		delete $3;
 | 
							delete $3;
 | 
				
			||||||
		free_attr($1);
 | 
							free_attr($1);
 | 
				
			||||||
 | 
						} |
 | 
				
			||||||
 | 
						attr '.' TOK_ID {
 | 
				
			||||||
 | 
							AstNode *node = new AstNode(AST_ARGUMENT);
 | 
				
			||||||
 | 
							node->str = *$3;
 | 
				
			||||||
 | 
							astbuf2->children.push_back(node);
 | 
				
			||||||
 | 
							node->children.push_back(new AstNode(AST_IDENTIFIER));
 | 
				
			||||||
 | 
							node->children.back()->str = *$3;
 | 
				
			||||||
 | 
							delete $3;
 | 
				
			||||||
 | 
							free_attr($1);
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
always_stmt:
 | 
					always_stmt:
 | 
				
			||||||
| 
						 | 
					@ -2167,6 +2176,15 @@ gen_stmt:
 | 
				
			||||||
		if ($6 != NULL)
 | 
							if ($6 != NULL)
 | 
				
			||||||
			delete $6;
 | 
								delete $6;
 | 
				
			||||||
		ast_stack.pop_back();
 | 
							ast_stack.pop_back();
 | 
				
			||||||
 | 
						} |
 | 
				
			||||||
 | 
						TOK_ELAB_TASK {
 | 
				
			||||||
 | 
							AstNode *node = new AstNode(AST_TECALL);
 | 
				
			||||||
 | 
							node->str = *$1;
 | 
				
			||||||
 | 
							delete $1;
 | 
				
			||||||
 | 
							ast_stack.back()->children.push_back(node);
 | 
				
			||||||
 | 
							ast_stack.push_back(node);
 | 
				
			||||||
 | 
						} opt_arg_list ';'{
 | 
				
			||||||
 | 
							ast_stack.pop_back();		
 | 
				
			||||||
	};
 | 
						};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gen_stmt_block:
 | 
					gen_stmt_block:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -277,11 +277,22 @@ void log_file_warning(const std::string &filename, int lineno,
 | 
				
			||||||
	va_list ap;
 | 
						va_list ap;
 | 
				
			||||||
	va_start(ap, format);
 | 
						va_start(ap, format);
 | 
				
			||||||
	std::string prefix = stringf("%s:%d: Warning: ",
 | 
						std::string prefix = stringf("%s:%d: Warning: ",
 | 
				
			||||||
				     filename.c_str(), lineno);
 | 
								filename.c_str(), lineno);
 | 
				
			||||||
	logv_warning_with_prefix(prefix.c_str(), format, ap);
 | 
						logv_warning_with_prefix(prefix.c_str(), format, ap);
 | 
				
			||||||
	va_end(ap);
 | 
						va_end(ap);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void log_file_info(const std::string &filename, int lineno,
 | 
				
			||||||
 | 
					                      const char *format, ...)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						va_list ap;
 | 
				
			||||||
 | 
						va_start(ap, format);
 | 
				
			||||||
 | 
						std::string fmt = stringf("%s:%d: Info: %s",
 | 
				
			||||||
 | 
								filename.c_str(), lineno, format);
 | 
				
			||||||
 | 
						logv(fmt.c_str(), ap);
 | 
				
			||||||
 | 
						va_end(ap);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
YS_ATTRIBUTE(noreturn)
 | 
					YS_ATTRIBUTE(noreturn)
 | 
				
			||||||
static void logv_error_with_prefix(const char *prefix,
 | 
					static void logv_error_with_prefix(const char *prefix,
 | 
				
			||||||
                                   const char *format, va_list ap)
 | 
					                                   const char *format, va_list ap)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,6 +80,7 @@ void log_warning(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Log with filename to report a problem in a source file.
 | 
					// Log with filename to report a problem in a source file.
 | 
				
			||||||
void log_file_warning(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
 | 
					void log_file_warning(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
 | 
				
			||||||
 | 
					void log_file_info(const std::string &filename, int lineno, const char *format, ...) YS_ATTRIBUTE(format(printf, 3, 4));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void log_warning_noprefix(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
 | 
					void log_warning_noprefix(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2));
 | 
				
			||||||
YS_NORETURN void log_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2), noreturn);
 | 
					YS_NORETURN void log_error(const char *format, ...) YS_ATTRIBUTE(format(printf, 1, 2), noreturn);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2026,7 +2026,6 @@ def gen_wrappers(filename, debug_level_ = 0):
 | 
				
			||||||
#include <boost/python/wrapper.hpp>
 | 
					#include <boost/python/wrapper.hpp>
 | 
				
			||||||
#include <boost/python/call.hpp>
 | 
					#include <boost/python/call.hpp>
 | 
				
			||||||
#include <boost/python.hpp>
 | 
					#include <boost/python.hpp>
 | 
				
			||||||
#include <boost/log/exceptions.hpp>
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
USING_YOSYS_NAMESPACE
 | 
					USING_YOSYS_NAMESPACE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +0,0 @@
 | 
				
			||||||
aig 3 2 0 1 1
 | 
					 | 
				
			||||||
6
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					@ -3,3 +3,6 @@ aag 3 2 0 1 1
 | 
				
			||||||
4
 | 
					4
 | 
				
			||||||
6
 | 
					6
 | 
				
			||||||
6 2 4
 | 
					6 2 4
 | 
				
			||||||
 | 
					i0 pi0
 | 
				
			||||||
 | 
					i1 pi1
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
							
								
								
									
										5
									
								
								tests/aiger/and_.aig
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								tests/aiger/and_.aig
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					aig 3 2 0 1 1
 | 
				
			||||||
 | 
					6
 | 
				
			||||||
 | 
					i0 pi0
 | 
				
			||||||
 | 
					i1 pi1
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,5 @@
 | 
				
			||||||
aag 1 1 0 1 0
 | 
					aag 1 1 0 1 0
 | 
				
			||||||
2
 | 
					2
 | 
				
			||||||
2
 | 
					2
 | 
				
			||||||
 | 
					i0 pi0
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,4 @@
 | 
				
			||||||
aig 1 1 0 1 0
 | 
					aig 1 1 0 1 0
 | 
				
			||||||
2
 | 
					2
 | 
				
			||||||
 | 
					i0 pi0
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,4 @@
 | 
				
			||||||
aag 1 0 1 0 0 1
 | 
					aag 1 0 1 0 0 1
 | 
				
			||||||
2 3
 | 
					2 3
 | 
				
			||||||
2
 | 
					2
 | 
				
			||||||
 | 
					b0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,4 @@
 | 
				
			||||||
aig 1 0 1 0 0 1
 | 
					aig 1 0 1 0 0 1
 | 
				
			||||||
3
 | 
					3
 | 
				
			||||||
2
 | 
					2
 | 
				
			||||||
 | 
					b0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,3 +6,4 @@ aag 5 1 1 0 3 1
 | 
				
			||||||
8 4 2
 | 
					8 4 2
 | 
				
			||||||
10 9 7
 | 
					10 9 7
 | 
				
			||||||
b0 AIGER_NEVER
 | 
					b0 AIGER_NEVER
 | 
				
			||||||
 | 
					i0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
aig 5 1 1 0 3 1
 | 
					aig 5 1 1 0 3 1
 | 
				
			||||||
10
 | 
					10
 | 
				
			||||||
4
 | 
					4
 | 
				
			||||||
b0 AIGER_NEVER
 | 
					i0 po0
 | 
				
			||||||
 | 
					b0 AIGER_NEVER
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
aag 0 0 0 1 0
 | 
					aag 0 0 0 1 0
 | 
				
			||||||
0
 | 
					0
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
aig 0 0 0 1 0
 | 
					aig 0 0 0 1 0
 | 
				
			||||||
0
 | 
					0
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,5 @@
 | 
				
			||||||
aag 1 1 0 1 0
 | 
					aag 1 1 0 1 0
 | 
				
			||||||
2
 | 
					2
 | 
				
			||||||
3
 | 
					3
 | 
				
			||||||
 | 
					i0 pi0
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,4 @@
 | 
				
			||||||
aig 1 1 0 1 0
 | 
					aig 1 1 0 1 0
 | 
				
			||||||
3
 | 
					3
 | 
				
			||||||
 | 
					i0 pi0
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -6,3 +6,4 @@ aag 5 1 1 0 3 1
 | 
				
			||||||
8 4 2
 | 
					8 4 2
 | 
				
			||||||
10 9 7
 | 
					10 9 7
 | 
				
			||||||
b0 AIGER_NEVER
 | 
					b0 AIGER_NEVER
 | 
				
			||||||
 | 
					i0 pi0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,4 +1,5 @@
 | 
				
			||||||
aig 5 1 1 0 3 1
 | 
					aig 5 1 1 0 3 1
 | 
				
			||||||
10
 | 
					10
 | 
				
			||||||
5
 | 
					5
 | 
				
			||||||
b0 AIGER_NEVER
 | 
					i0 pi0
 | 
				
			||||||
 | 
					b0 AIGER_NEVER
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +0,0 @@
 | 
				
			||||||
aig 3 2 0 1 1
 | 
					 | 
				
			||||||
7
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
| 
						 | 
					@ -3,3 +3,6 @@ aag 3 2 0 1 1
 | 
				
			||||||
4
 | 
					4
 | 
				
			||||||
7
 | 
					7
 | 
				
			||||||
6 3 5
 | 
					6 3 5
 | 
				
			||||||
 | 
					i0 pi0
 | 
				
			||||||
 | 
					i1 pi1
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
							
								
								
									
										5
									
								
								tests/aiger/or_.aig
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								tests/aiger/or_.aig
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,5 @@
 | 
				
			||||||
 | 
					aig 3 2 0 1 1
 | 
				
			||||||
 | 
					7
 | 
				
			||||||
 | 
					i0 pi0
 | 
				
			||||||
 | 
					i1 pi1
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
| 
						 | 
					@ -1,24 +1,37 @@
 | 
				
			||||||
#!/bin/bash
 | 
					#!/bin/bash
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OPTIND=1
 | 
					set -e
 | 
				
			||||||
seed=""    # default to no seed specified
 | 
					
 | 
				
			||||||
while getopts "S:" opt
 | 
					for aag in *.aag; do
 | 
				
			||||||
do
 | 
					    # Since ABC cannot read *.aag, read the *.aig instead
 | 
				
			||||||
    case "$opt" in
 | 
					    # (which would have been created by the reference aig2aig utility)
 | 
				
			||||||
	S) arg="${OPTARG#"${OPTARG%%[![:space:]]*}"}" # remove leading space
 | 
					    ../../yosys-abc -c "read -c ${aag%.*}.aig; write ${aag%.*}_ref.v"
 | 
				
			||||||
	   seed="SEED=$arg" ;;
 | 
					    ../../yosys -p "
 | 
				
			||||||
    esac
 | 
					read_verilog ${aag%.*}_ref.v
 | 
				
			||||||
 | 
					prep
 | 
				
			||||||
 | 
					design -stash gold
 | 
				
			||||||
 | 
					read_aiger -clk_name clock $aag
 | 
				
			||||||
 | 
					prep
 | 
				
			||||||
 | 
					design -stash gate
 | 
				
			||||||
 | 
					design -import gold -as gold
 | 
				
			||||||
 | 
					design -import gate -as gate
 | 
				
			||||||
 | 
					miter -equiv -flatten -make_assert -make_outputs gold gate miter
 | 
				
			||||||
 | 
					sat -verify -prove-asserts -show-ports -seq 16 miter
 | 
				
			||||||
 | 
					"
 | 
				
			||||||
done
 | 
					done
 | 
				
			||||||
shift "$((OPTIND-1))"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# check for Icarus Verilog
 | 
					for aig in *.aig; do
 | 
				
			||||||
if ! which iverilog > /dev/null ; then
 | 
					    ../../yosys-abc -c "read -c $aig; write ${aig%.*}_ref.v"
 | 
				
			||||||
  echo "$0: Error: Icarus Verilog 'iverilog' not found."
 | 
					    ../../yosys -p "
 | 
				
			||||||
  exit 1
 | 
					read_verilog ${aig%.*}_ref.v
 | 
				
			||||||
fi
 | 
					prep
 | 
				
			||||||
 | 
					design -stash gold
 | 
				
			||||||
echo "===== AAG ======"
 | 
					read_aiger -clk_name clock $aig
 | 
				
			||||||
${MAKE:-make} -f ../tools/autotest.mk $seed *.aag EXTRA_FLAGS="-f aiger"
 | 
					prep
 | 
				
			||||||
 | 
					design -stash gate
 | 
				
			||||||
echo "===== AIG ======"
 | 
					design -import gold -as gold
 | 
				
			||||||
exec ${MAKE:-make} -f ../tools/autotest.mk $seed *.aig EXTRA_FLAGS="-f aiger"
 | 
					design -import gate -as gate
 | 
				
			||||||
 | 
					miter -equiv -flatten -make_assert -make_outputs gold gate miter
 | 
				
			||||||
 | 
					sat -verify -prove-asserts -show-ports -seq 16 miter
 | 
				
			||||||
 | 
					"
 | 
				
			||||||
 | 
					done
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,3 +2,5 @@ aag 1 0 1 2 0
 | 
				
			||||||
2 3
 | 
					2 3
 | 
				
			||||||
2
 | 
					2
 | 
				
			||||||
3
 | 
					3
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
 | 
					o1 po1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2,3 +2,5 @@ aig 1 0 1 2 0
 | 
				
			||||||
3
 | 
					3
 | 
				
			||||||
2
 | 
					2
 | 
				
			||||||
3
 | 
					3
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
 | 
					o1 po1
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
aag 0 0 0 1 0
 | 
					aag 0 0 0 1 0
 | 
				
			||||||
1
 | 
					1
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,2 +1,3 @@
 | 
				
			||||||
aig 0 0 0 1 0
 | 
					aig 0 0 0 1 0
 | 
				
			||||||
1
 | 
					1
 | 
				
			||||||
 | 
					o0 po0
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										16
									
								
								tests/simple/implicit_ports.v
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								tests/simple/implicit_ports.v
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,16 @@
 | 
				
			||||||
 | 
					// Test implicit port connections
 | 
				
			||||||
 | 
					module alu (input [2:0] a, input [2:0] b, input cin, output cout, output [2:0] result);
 | 
				
			||||||
 | 
						assign cout = cin;
 | 
				
			||||||
 | 
						assign result = a + b;
 | 
				
			||||||
 | 
					endmodule
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module named_ports(input [2:0] a, b, output [2:0] alu_result, output cout);
 | 
				
			||||||
 | 
						wire cin = 1;
 | 
				
			||||||
 | 
						alu alu (
 | 
				
			||||||
 | 
							.a(a),
 | 
				
			||||||
 | 
							.b, // Implicit connection is equivalent to .b(b)
 | 
				
			||||||
 | 
							.cin(), // Explicitely unconnected
 | 
				
			||||||
 | 
							.cout(cout),
 | 
				
			||||||
 | 
							.result(alu_result)
 | 
				
			||||||
 | 
						);
 | 
				
			||||||
 | 
					endmodule
 | 
				
			||||||
| 
						 | 
					@ -17,4 +17,5 @@ if ! which iverilog > /dev/null ; then
 | 
				
			||||||
  exit 1
 | 
					  exit 1
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exec ${MAKE:-make} -f ../tools/autotest.mk $seed *.v
 | 
					shopt -s nullglob
 | 
				
			||||||
 | 
					exec ${MAKE:-make} -f ../tools/autotest.mk $seed *.{sv,v}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -89,6 +89,13 @@ done
 | 
				
			||||||
 | 
					
 | 
				
			||||||
compile_and_run() {
 | 
					compile_and_run() {
 | 
				
			||||||
	exe="$1"; output="$2"; shift 2
 | 
						exe="$1"; output="$2"; shift 2
 | 
				
			||||||
 | 
						ext=${1##*.}
 | 
				
			||||||
 | 
						if [ "$ext" == "sv" ]; then
 | 
				
			||||||
 | 
							language_gen="-g2012"
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							language_gen="-g2005"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if $use_modelsim; then
 | 
						if $use_modelsim; then
 | 
				
			||||||
		altver=$( ls -v /opt/altera/ | grep '^[0-9]' | tail -n1; )
 | 
							altver=$( ls -v /opt/altera/ | grep '^[0-9]' | tail -n1; )
 | 
				
			||||||
		/opt/altera/$altver/modelsim_ase/bin/vlib work
 | 
							/opt/altera/$altver/modelsim_ase/bin/vlib work
 | 
				
			||||||
| 
						 | 
					@ -99,7 +106,7 @@ compile_and_run() {
 | 
				
			||||||
		/opt/Xilinx/Vivado/$xilver/bin/xvlog $xinclude_opts -d outfile=\"$output\" "$@"
 | 
							/opt/Xilinx/Vivado/$xilver/bin/xvlog $xinclude_opts -d outfile=\"$output\" "$@"
 | 
				
			||||||
		/opt/Xilinx/Vivado/$xilver/bin/xelab -R work.testbench
 | 
							/opt/Xilinx/Vivado/$xilver/bin/xelab -R work.testbench
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		iverilog $include_opts -Doutfile=\"$output\" -s testbench -o "$exe" "$@"
 | 
							iverilog $language_gen $include_opts -Doutfile=\"$output\" -s testbench -o "$exe" "$@"
 | 
				
			||||||
		vvp -n "$exe"
 | 
							vvp -n "$exe"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -110,7 +117,7 @@ for fn
 | 
				
			||||||
do
 | 
					do
 | 
				
			||||||
	bn=${fn%.*}
 | 
						bn=${fn%.*}
 | 
				
			||||||
	ext=${fn##*.}
 | 
						ext=${fn##*.}
 | 
				
			||||||
	if [[ "$ext" != "v" ]] && [[ "$ext" != "aag" ]] && [[ "$ext" != "aig" ]]; then
 | 
						if [[ "$ext" != "v" ]] && [[ "$ext" != "sv" ]] && [[ "$ext" != "aag" ]] && [[ "$ext" != "aig" ]]; then
 | 
				
			||||||
		echo "Invalid argument: $fn" >&2
 | 
							echo "Invalid argument: $fn" >&2
 | 
				
			||||||
		exit 1
 | 
							exit 1
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
| 
						 | 
					@ -123,6 +130,10 @@ do
 | 
				
			||||||
		echo -n "Test: $bn "
 | 
							echo -n "Test: $bn "
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						if [ "$ext" == sv ]; then
 | 
				
			||||||
 | 
							frontend="$frontend -sv"
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rm -f ${bn}.{err,log,skip}
 | 
						rm -f ${bn}.{err,log,skip}
 | 
				
			||||||
	mkdir -p ${bn}.out
 | 
						mkdir -p ${bn}.out
 | 
				
			||||||
	rm -rf ${bn}.out/*
 | 
						rm -rf ${bn}.out/*
 | 
				
			||||||
| 
						 | 
					@ -135,9 +146,10 @@ do
 | 
				
			||||||
		rm -f ${bn}_ref.fir
 | 
							rm -f ${bn}_ref.fir
 | 
				
			||||||
		if [[ "$ext" == "v" ]]; then
 | 
							if [[ "$ext" == "v" ]]; then
 | 
				
			||||||
			egrep -v '^\s*`timescale' ../$fn > ${bn}_ref.${ext}
 | 
								egrep -v '^\s*`timescale' ../$fn > ${bn}_ref.${ext}
 | 
				
			||||||
 | 
							elif [[ "$ext" == "aig" ]] || [[ "$ext" == "aag" ]]; then
 | 
				
			||||||
 | 
								"$toolsdir"/../../yosys-abc -c "read_aiger ../${fn}; write ${bn}_ref.v"
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			"$toolsdir"/../../yosys -f "$frontend $include_opts" -b "verilog" -o ${bn}_ref.v ../${fn}
 | 
								cp ../${fn} ${bn}_ref.${ext}
 | 
				
			||||||
			frontend="verilog -noblackbox"
 | 
					 | 
				
			||||||
		fi
 | 
							fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if [ ! -f ../${bn}_tb.v ]; then
 | 
							if [ ! -f ../${bn}_tb.v ]; then
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										30
									
								
								tests/various/elab_sys_tasks.sv
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								tests/various/elab_sys_tasks.sv
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,30 @@
 | 
				
			||||||
 | 
					module test;
 | 
				
			||||||
 | 
					localparam X=1;
 | 
				
			||||||
 | 
					genvar i;
 | 
				
			||||||
 | 
					generate
 | 
				
			||||||
 | 
					if (X == 1)
 | 
				
			||||||
 | 
					  $info("X is 1");
 | 
				
			||||||
 | 
					if (X == 1)
 | 
				
			||||||
 | 
					  $warning("X is 1");
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					  $error("X is not 1");
 | 
				
			||||||
 | 
					case (X)
 | 
				
			||||||
 | 
					  1: $info("X is 1 in a case statement");
 | 
				
			||||||
 | 
					endcase
 | 
				
			||||||
 | 
					//case (X-1)
 | 
				
			||||||
 | 
					//  1: $warn("X is 2");
 | 
				
			||||||
 | 
					//  default: $warn("X might be anything in a case statement");
 | 
				
			||||||
 | 
					//endcase
 | 
				
			||||||
 | 
					for (i = 0; i < 3; i = i + 1)
 | 
				
			||||||
 | 
					begin
 | 
				
			||||||
 | 
					  case(i)
 | 
				
			||||||
 | 
					    0: $info;
 | 
				
			||||||
 | 
					    1: $warning;
 | 
				
			||||||
 | 
					    default: $info("default case statemnent");
 | 
				
			||||||
 | 
					  endcase
 | 
				
			||||||
 | 
					end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					$info("This is a standalone $info(). Next $info has no parameters");
 | 
				
			||||||
 | 
					$info;
 | 
				
			||||||
 | 
					endgenerate
 | 
				
			||||||
 | 
					endmodule
 | 
				
			||||||
							
								
								
									
										1
									
								
								tests/various/elab_sys_tasks.ys
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tests/various/elab_sys_tasks.ys
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1 @@
 | 
				
			||||||
 | 
					read_verilog -sv elab_sys_tasks.sv
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue