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

FPGA Prototyping Error Caused by Vivado Tcl Interpreter: fpga-shells/xilinx/common/tcl/prologue.tcl #167

Open
3 tasks done
zslwyuan opened this issue Mar 13, 2022 · 1 comment

Comments

@zslwyuan
Copy link

Background Work

Chipyard Version and Hash

Release: 1.5.0
Hash: a6a6a6

OS Setup

Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal

Other Setup

Go through the standard FPGA prototyping flow in Chipyard Documentation

Current Behavior

As mentioned in Chipyard Google Group here:

When I excute the command "make SUB_PROJECT=vcu118 CONFIG=RocketVCU118Config bitstream" ERROR as follows:

source /home/liupeipei/chipyard/fpga/fpga-shells/xilinx/common/tcl/vivado.tcl
# set scriptdir [file dirname [info script]]
# source [file join $scriptdir "prologue.tcl"]
## set ip_vivado_tcls {}
## while {[llength $argv]} {
##   set argv [lassign $argv[set argv {}] flag]
##   switch -glob $flag {
##     -top-module {
##       set argv [lassign $argv[set argv {}] top]
##     }
##     -F {
##       # This should be a simple file format with one filepath per line
##       set argv [lassign $argv[set argv {}] vsrc_manifest]
##     }
##     -board {
##       set argv [lassign $argv[set argv {}] board]
##     }
##     -ip-vivado-tcls {
##       set argv [lassign $argv[set argv {}] ip_vivado_tcls]
##     }
##     -pre-impl-debug-tcl {
##       set argv [lassign $argv[set argv {}] pre_impl_debug_tcl]
##     }
##     -post-impl-debug-tcl {
##       set argv [lassign $argv[set argv {}] post_impl_debug_tcl]
##     }
##     -env-var-srcs {
##       set argv [lassign $argv[set argv {}] env_var_srcs]
##     }
##     default {
##       return -code error [list {unknown option} $flag]
##     }
##   }
## }
{unknown option} {}

    while executing
"source [file join $scriptdir "prologue.tcl"]"
    (file "/home/liupeipei/chipyard/fpga/fpga-shells/xilinx/common/tcl/vivado.tcl" line 7)
INFO: [Common 17-206] Exiting Vivado at Wed Mar  2 10:41:24 2022...
make: *** [Makefile:115: /home/liupeipei/chipyard/fpga/generated-src/chipyard.fpga.vcu118.VCU118FPGATestHarness.RocketVCU118Config/obj/VCU118FPGATestHarness.bit] Error 1

Expected Behavior

The Tcl script should work fine with Error

Other Information

This is a bug of Vivado Tcl interpreter. I am not sure whether I should make a new pull request since the solution is a little bit dirty by modifying the file fpga/fpga-shells/xilinx/common/tcl/prologue.tcl. I provided the solution here in case someone else encounters this similar problem.

-ip-vivado-tcls {
  set ip_vivado_tcls {}
  while {[llength $argv]}  {
  	  set firstArg [lindex $argv 0]
  	  set isTclFile [string match *.tcl $firstArg]
  	  if {$isTclFile}   	  {
  	        puts "adding tcl file: ${firstArg}"
  	   	set argv [lassign $argv[set argv {}] firstArg]
  	   	lappend ip_vivado_tcls $firstArg
  	   	puts "tcl file list: ${ip_vivado_tcls}"
  	  } else  {
  	      puts "terminate addition of tcl while argv= ${argv}"
  	      break
  	  }
  }
}
@codoor
Copy link

codoor commented Mar 28, 2022

I think encounter this problem is because this is no option "{ }", but argv is end of "{ }". I try to fix this by add a option "{ }" with empty operation in the switch list.

......
switch -glob $flag {
    {} {
      
    }
    -top-module {
      set argv [lassign $argv[set argv {}] top]
    }
    -F {
......

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants