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

Add package 'Encodings' #9

Merged
merged 18 commits into from
Jan 13, 2020
Merged

Add package 'Encodings' #9

merged 18 commits into from
Jan 13, 2020

Conversation

eine
Copy link
Collaborator

@eine eine commented Nov 29, 2019

Coming from VUnit/vunit#588 and VUnit/vunit#595, the main purpose of this PR is to add the possibility to encode generic strings, in order to work around the limitations of some simulators which do not accept all the symbols.

This is achieved by adding a new package (Encodings). Currently, it contains functions b16encode and b16decode only. Nonetheless, it can be extended in the future to support other encodings such as base32 or base64. Precisely, the naming of the functions mimicks https://docs.python.org/3/library/base64.html.

A function named decode is used in jsonLoad to detect and decode the input, if required. As a result, users don't need to change their VHDL code to use new feature. Decoding is done before loading the JSON file. Hence, it is possible to encode the path to the JSON file, should any simulator have issues with \, /, :, etc. and should the length also be limited. The detection logic can be significantly improved: https://stackoverflow.com/questions/18419428/what-is-the-minimum-valid-json

A new testbench ( Examples/Encodings_VUnit.vhdl) is added, where encoding/decoding functions are tested independently from JSON features. Apart from that, example Boards_VUnit.vhdl is extended:

  • Four tests are described: stringified JSON generic, b16encoded stringified JSON generic, JSON file path generic and b16encoded JSON file path generic.
  • Procedures test_board0 and test_board1 are described. These can be potentially saved in a separate package, to be used in other testbenches.
  • In the run.py file, from base64 import b16encode is used to encode the stringified JSON/object.

Apart from adding 'Encodings', since this projects has not been updated in 1.5y, I added other modifications to this PR:

  • jsonLoadFile was merged into jsonLoad, but the former is still shown in the README and used in Boards2. It is fixed.
  • Subdir 'Tests' is created and subdir 'vhdl' is renamed to 'Src'.
  • The script to execute VUnit tests in a docker container is outdated. It is updated and it is generalized, in order to be used to run different tests/examples.
  • Example Boards2 is updated to fix it after renaming/moving Tests/Src. Also, a shell script which is equivalent to the existing Boards.cmd file is added.
  • A GitHub Actions (GHA) workflow is added, where Tests/VUnit and Tests/ghdl are executed.
  • Travis CI is deprecated and .travis.yml is removed.

/cc @LarsAsplund @felixn

@claassistantio
Copy link

claassistantio commented Nov 29, 2019

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Examples/Boards2.vhdl Outdated Show resolved Hide resolved
.github/workflows/test.yml Show resolved Hide resolved
Src/Encodings.pkg.vhdl Outdated Show resolved Hide resolved
Src/Encodings.pkg.vhdl Outdated Show resolved Hide resolved
Src/Encodings.pkg.vhdl Outdated Show resolved Hide resolved
Src/Encodings.pkg.vhdl Outdated Show resolved Hide resolved
Src/Encodings.pkg.vhdl Outdated Show resolved Hide resolved
Src/Encodings.pkg.vhdl Outdated Show resolved Hide resolved
Src/Encodings.pkg.vhdl Outdated Show resolved Hide resolved
@Paebbels
Copy link
Owner

When editing files to reflect the reviews above, please do also these minor changes:

  • rename Src to src
  • rename Tests to tests

@eine eine force-pushed the encodings branch 3 times, most recently from eaebf6d to 19ec558 Compare January 12, 2020 23:26
Src/JSON.pkg.vhdl Outdated Show resolved Hide resolved
@eine eine force-pushed the encodings branch 3 times, most recently from df837ff to 3288575 Compare January 13, 2020 00:13
@Paebbels Paebbels merged commit c8a6f51 into Paebbels:master Jan 13, 2020
@eine eine deleted the encodings branch January 13, 2020 00:21
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

Successfully merging this pull request may close these issues.

3 participants