<commit_before>= UCF2XDC converter

The `ucf-to-xdc.sh` script for Xilinx EDA-tools: that convert ISE-style to Vivado-style constraints (sdc -> xdc)

== usage
Just type:
```
./ucf-to-xdc.sh FILENAME.ucf
```
that produce the file `FILENAME.xdc` in current dir

=== input file example [ucf]
```
NET "DDR_DQ[0]"  LOC = "AY12"  |  IOSTANDARD = SSTL15_T_DCI  |  VCCAUX_IO = NORMAL  |  SLEW = FAST;
NET "DDR_DQ[1]"  LOC = "AW12"  |  IOSTANDARD = SSTL15_T_DCI  |  VCCAUX_IO = NORMAL  |  SLEW = FAST;
```

=== output file example [xdc]
```
set_property PACKAGE_PIN AY12         [get_ports DDR_DQ[0]]
set_property IOSTANDARD  SSTL15_T_DCI [get_ports DDR_DQ[0]]
set_property VCCAUX_IO   NORMAL       [get_ports DDR_DQ[0]]
set_property SLEW        FAST         [get_ports DDR_DQ[0]]

set_property PACKAGE_PIN AW12         [get_ports DDR_DQ[1]]
set_property IOSTANDARD  SSTL15_T_DCI [get_ports DDR_DQ[1]]
set_property VCCAUX_IO   NORMAL       [get_ports DDR_DQ[1]]
set_property SLEW        FAST         [get_ports DDR_DQ[1]]
```

== Limitation

This script works only with IO-location and standard constraints

== Explanation of working

sed command explanation:

* `/^$/d` - remove all empty strings
* `s/[\"=|;]//g` - remove any of these symbols: `"`, `=`, `|`, `;`
* `s/[\t]*//g` -  remove all horizontal tabulation symbol
* `s/\ \{1,\}/\ /g` - replace several whitespaces by one (i.e.: `"    "` -> `" "`)
* Formatting output string (parted by several string):
** `s/NET[ ]*\(.*\)[ ]*`.. - extract signal name
** ..`LOC[ ]*\([A-Z0-9]*\)[ ]*`.. - extract pin name
** ..`IOSTANDARD[ ]*\([_A-Z0-9]*\)[ ]*`.. - extract IO-standard
** ..`VCCAUX_IO[ ]*\([A-Z]*\)[ ]*`.. - extract VCCAUX value
** ..`SLEW[ ]*\([A-Z]*\)/`.. - extract slewrate
** ..`set_property PACKAGE_PIN \2 \[get_ports \1\]\n`.. - generate location constraint
** ..`set_property IOSTANDARD  \3 \[get_ports \1\]\n`.. - generate IO-standard constraint
** ..`set_property VCCAUX_IO   \4 \[get_ports \1\]\n`.. - generate VCCAUX value constraint
** ..`set_property SLEW        \5 \[get_ports \1\]\n\n/g` -  generate slew rate constraint


== ToDo

* a position independent parser of ucf

== Known issues<commit_msg>[ucf-to-xdc.sh] new goal for todo<commit_after>= UCF2XDC converter

The `ucf-to-xdc.sh` script for Xilinx EDA-tools: that convert ISE-style to Vivado-style constraints (sdc -> xdc)

== usage
Just type:
```
./ucf-to-xdc.sh FILENAME.ucf
```
that produce the file `FILENAME.xdc` in current dir

=== input file example [ucf]
```
NET "DDR_DQ[0]"  LOC = "AY12"  |  IOSTANDARD = SSTL15_T_DCI  |  VCCAUX_IO = NORMAL  |  SLEW = FAST;
NET "DDR_DQ[1]"  LOC = "AW12"  |  IOSTANDARD = SSTL15_T_DCI  |  VCCAUX_IO = NORMAL  |  SLEW = FAST;
```

=== output file example [xdc]
```
set_property PACKAGE_PIN AY12         [get_ports DDR_DQ[0]]
set_property IOSTANDARD  SSTL15_T_DCI [get_ports DDR_DQ[0]]
set_property VCCAUX_IO   NORMAL       [get_ports DDR_DQ[0]]
set_property SLEW        FAST         [get_ports DDR_DQ[0]]

set_property PACKAGE_PIN AW12         [get_ports DDR_DQ[1]]
set_property IOSTANDARD  SSTL15_T_DCI [get_ports DDR_DQ[1]]
set_property VCCAUX_IO   NORMAL       [get_ports DDR_DQ[1]]
set_property SLEW        FAST         [get_ports DDR_DQ[1]]
```

== Limitation

This script works only with IO-location and standard constraints

== Explanation of working

sed command explanation:

* `/^$/d` - remove all empty strings
* `s/[\"=|;]//g` - remove any of these symbols: `"`, `=`, `|`, `;`
* `s/[\t]*//g` -  remove all horizontal tabulation symbol
* `s/\ \{1,\}/\ /g` - replace several whitespaces by one (i.e.: `"    "` -> `" "`)
* Formatting output string (parted by several string):
** `s/NET[ ]*\(.*\)[ ]*`.. - extract signal name
** ..`LOC[ ]*\([A-Z0-9]*\)[ ]*`.. - extract pin name
** ..`IOSTANDARD[ ]*\([_A-Z0-9]*\)[ ]*`.. - extract IO-standard
** ..`VCCAUX_IO[ ]*\([A-Z]*\)[ ]*`.. - extract VCCAUX value
** ..`SLEW[ ]*\([A-Z]*\)/`.. - extract slewrate
** ..`set_property PACKAGE_PIN \2 \[get_ports \1\]\n`.. - generate location constraint
** ..`set_property IOSTANDARD  \3 \[get_ports \1\]\n`.. - generate IO-standard constraint
** ..`set_property VCCAUX_IO   \4 \[get_ports \1\]\n`.. - generate VCCAUX value constraint
** ..`set_property SLEW        \5 \[get_ports \1\]\n\n/g` -  generate slew rate constraint


== ToDo

* a position independent parser of ucf
* move to new one-string format of xdc, like this:
+
```
set_property -dict {PACKAGE_PIN AY12  IOSTANDARD SSTL15_T_DCI  VCCAUX_IO NORMAL  SLEW FAST} [get_ports DDR_DQ[0]];
```


== Known issues
{'fraction_non_alphanumeric': 0.17687375635640062, 'fraction_numerical': 0.018792836612867566, 'mean_word_length': 3.2639019792648445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1949442', 'n_tokens_mistral': 1907, 'n_tokens_neox': 1774, 'n_words': 448}