---
# System prepended metadata

title: Regular Meeting (2022.6.13)
tags: [Regular Meeting, DeWei]

---

# Regular Meeting (2022.6.13)

* [Comparison between ZedBoard and Nexys](https://hackmd.io/@BelleII-CDC-Trig-NTU-DeWei/HyZBi_lYq)
* Zybo-z7: 
	* TCL `if-else` -> `switch-case` in the [getopt](https://en.wikipedia.org/wiki/Getopts)


## TCL if-else -> switch-case in the getopt
* Modified: `build_fsbl.tcl`, `gen_base_dt.tcl`, `top.tcl`

### old: if-else (o)
```tclsh
    if {$arg(${iter}) == $arg(B)} {
      set kBuildDir $arg(${iter})
    } elseif {$arg(${iter}) == $arg(O)} {
      set kOutputDir $arg(${iter})
    } elseif {$arg(${iter}) == $arg(U)} {
      set kTCLUtilitiesTopDir $arg(${iter})
    } elseif {$arg(${iter}) == $arg(t)} {
      set kAPPName $arg(${iter})
    } elseif {$arg(${iter}) == $arg(x)} {
      set kXSAFilePath $arg(${iter})
    } else {
      error "Input arguments error"
    }
    
```

### new: switch (x)
```tclsh
    switch $arg(${iter}) {
      $arg(B) {
        set kBuildDir $arg(${iter})
      }      
      $arg(O) {
        set kOutputDir $arg(${iter})
      }
      $arg(U) {
        set kTCLUtilitiesTopDir $arg(${iter})
      }
      $arg(t) {
        set kAPPName $arg(${iter})
      }
      $arg(x) {
        set kXSAFilePath $arg(${iter})
      }
      default {
        error "Input arguments error"
      }
    }
```

### new: switch (o)
```tclsh
    switch $arg(${iter}) \
      $arg(B) { \
        set kBuildDir $arg(${iter}) \
      } \
      $arg(O) { \
        set kOutputDir $arg(${iter})\
      } \
      $arg(t) { \
        set kAPPName $arg(${iter})\
      } \
      $arg(U) { \
        set kTCLUtilitiesTopDir $arg(${iter})\
      } \
      $arg(x) { \
        set kXSAFilePath $arg(${iter})\
      } \
      default { \
        error "Input arguments error"\
      }
```

or

```tclsh
    switch $arg(${iter}) \
      $arg(B) { set kBuildDir $arg(${iter}) } \
      $arg(O) { set kOutputDir $arg(${iter})} \
      $arg(t) { set kAPPName $arg(${iter})} \
      $arg(U) { set kTCLUtilitiesTopDir $arg(${iter})} \
      $arg(x) { set kXSAFilePath $arg(${iter})} \
      default { error "Input arguments error" }
```

### Note:
* Be care of `space` after `\`
* Asked in [*stackoverflow*](https://stackoverflow.com/questions/72545223/about-getopt-and-switch-statement-in-tclsh)
	* Long time ago, this post is I renewed last week
	* No reply
* [Tek-tips](https://www.tek-tips.com/viewthread.cfm?qid=1817685) I/F is shabby but more focused on *TCL* than stackoverflow



###### tags: `Regular Meeting` `DeWei`