Skip to content
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

[DO NOT MERGE] Start of unit test tools #2502

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions flow/util/test_openroad
67 changes: 67 additions & 0 deletions flow/util/test_tool
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/tclsh

puts "Run: $argv0 $argv"

# Provide our own implementation
proc unknown args {
puts "Command: $args"
}

if { [regexp yosys $argv0] } {
# Writes an empty .v
proc write_verilog {args} {
unknown "write_verilog" {*}$args
set file_name [lindex $args [expr {[llength $args] - 1}]]
set fileId [open $file_name "w"]
#puts $fileId "{\"modules\" : {}}"
close $fileId
}

# Writes a dummy json for mem_dump.py
proc json {args} {
unknown "json" {*}$args
for {set i 0} {$i < [llength $args]} {incr i} {
set arg [lindex $args $i]

if {$arg == "-o"} {
#incr i
set fileId [open [lindex $args $i+1] "w"]
puts $fileId "{\"modules\" : {}}"
close $fileId
}
}
}

# Execute any "-c script" arg
for {set i 0} {$i < [llength $argv]} {incr i} {
set arg [lindex $argv $i]

# Check if the argument is "-c"
if {$arg == "-c"} {
incr i
source [lindex $argv $i]
}
}
} elseif { [regexp openroad $argv0] } {
puts "OPENROAD"

# Writes an empty .odb
proc write_db {args} {
unknown "write_db" {*}$args
set file_name [lindex $args 0]
set fileId [open $file_name "w"]
close $fileId
}

# Execute any tcl file
for {set i 0} {$i < [llength $argv]} {incr i} {
set arg [lindex $argv $i]

# Check if the argument is "-c"
if { [regexp "\.tcl$" $arg] } {
source $arg
}
}
} else {
error "Unknown tool $argv0"
}
1 change: 1 addition & 0 deletions flow/util/test_yosys
Loading