Skip to content

Conversation

@eine
Copy link
Collaborator

@eine eine commented Nov 27, 2019

Close #588

This is a proof of concept to encode stringified JSON generics in Python and decode them in VHDL. Example json4vhdl is reworked to handle three separate tests: stringified JSON, stringified and b16encoded JSON, and path to a JSON file.

In the current implementation, a package named encodings is added to VUnit. This includes b16decode and b16encode only, for now. Nonetheless, as commented in #588, this package might be merged into JSON-for-VHDL, instead of being added to VUnit.

@eine eine force-pushed the encoded-generics branch 2 times, most recently from 3e9a005 to 826995d Compare November 27, 2019 15:10
end;

architecture a of tb_encodings is
constant str: string := "[""test"",[true,false,18,null,""hello""],[9,8],3324.34,832432,""world""]";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe making str and enc generics of tb_encodings and passing them in from run.py tests more / closer to the json usecase? It would also make it very easy to use this to test maximum generic string lengths of various simulators.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tests in tb_encodings are to test encoding/decoding functions/procedures, which we should be able to do independently of the generic support of the simulator. I think that what you suggest belongs to example json4vhdl.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I now extended the existing tb_set_generic acceptance test, to pass a long generic string. The content is created repeating 0123456789abcdef str_long_num times. Now, it is set to 512; hence, the length of the string is 512*16=8192. We should set str_long_num to the minimum length that we want any simulator to support. Do you have any reference of which is a sensible value?

Moreover, if other encondings are added, I believe that this testbench can be extended to test the character sets used in other encodings (b32, b64).

@eine eine force-pushed the encoded-generics branch 2 times, most recently from eb8f741 to 8cc3201 Compare November 28, 2019 10:53
@eine eine force-pushed the encoded-generics branch 2 times, most recently from 4036c8b to 0b1a5f4 Compare November 29, 2019 05:40
@eine
Copy link
Collaborator Author

eine commented Nov 29, 2019

This PR is now based on Paebbels/JSON-for-VHDL#9.

@eine eine force-pushed the encoded-generics branch 3 times, most recently from 8740f16 to 85b3a73 Compare December 1, 2019 10:21
@eine eine force-pushed the encoded-generics branch from 85b3a73 to 1ccd6de Compare January 3, 2020 03:50
@eine eine force-pushed the encoded-generics branch 3 times, most recently from 3f482fd to 3198655 Compare January 13, 2020 03:45
@eine
Copy link
Collaborator Author

eine commented Jan 13, 2020

Paebbels/JSON-for-VHDL#9 is now merged upstream.

@eine eine requested a review from LarsAsplund January 13, 2020 04:09
@eine eine marked this pull request as ready for review January 13, 2020 04:14
@eine eine changed the title WIP extend json4vhdl with b16 encodings json4vhdl: use base16 encodings Jan 13, 2020
@eine eine force-pushed the encoded-generics branch from 3198655 to 7317e63 Compare January 15, 2020 23:08
@eine eine force-pushed the encoded-generics branch 5 times, most recently from 7b62e57 to 63aee0c Compare January 26, 2020 03:45
@eine eine merged commit aed30f0 into VUnit:master Feb 14, 2020
@eine eine deleted the encoded-generics branch February 14, 2020 23:48
@eine eine added the ThirdParty: JSON Related to JSON-for-VHDL. label Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ThirdParty: JSON Related to JSON-for-VHDL.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Constraints on generic types

3 participants