{"id":19096200,"url":"https://github.com/cobular/testvectorgenerator","last_synced_at":"2026-05-26T15:30:17.248Z","repository":{"id":119391762,"uuid":"456307626","full_name":"Cobular/TestVectorGenerator","owner":"Cobular","description":"A tool to easily generate robust and complete logisim test vectors","archived":false,"fork":false,"pushed_at":"2022-04-21T17:26:19.000Z","size":68,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-09T03:38:35.412Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cobular.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-02-07T00:16:33.000Z","updated_at":"2022-04-21T17:24:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"62282177-c665-4db2-bdc6-6960a5375939","html_url":"https://github.com/Cobular/TestVectorGenerator","commit_stats":null,"previous_names":["cobular/logisimtestvectorgenerator"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cobular%2FTestVectorGenerator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cobular%2FTestVectorGenerator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cobular%2FTestVectorGenerator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cobular%2FTestVectorGenerator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cobular","download_url":"https://codeload.github.com/Cobular/TestVectorGenerator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232271972,"owners_count":18497773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T03:36:04.988Z","updated_at":"2026-05-26T15:30:17.211Z","avatar_url":"https://github.com/Cobular.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logisim-Evolution Test Vector Generator\n\n_Logisim test vector generation made easy!_\n\nRecently, the powerful digital circuit design learning tool Logisim \nreceived an update to support Test Vectors, essentially a file containing \nthe spec for unit tests of your circuit. However, those must be manually \ngenerated, which is prone to mistakes and other weird issues and can be a \nPITA when you're taking about like 128 lines of cases.\n\nInstead, we can just utilize Python to generate these test vectors for us, \nallowing for much more reliable and robust testing than would otherwise be \npossible!\n\nThis project facilitates the generation of these test vector files, \nallowing you to easily create your own functions to generate the inputs and \noutputs of your circuit while the project does the bulk of the work of \ncoordinating these functions and formatting that whole mess into a test \nvector file. \n\n#### Liability Notice\nI can't guarantee that this works perfectly or even properly. I plan to use \nit for the class project and plan to keep it updated as I catch bugs but I \nmake no guarantees that this will always spit out the right answer or \nanything like that. Use at your own risk.\n\n# Using\nJust clone the project and run `python ./main.py` to generate all the \ndescribed test vectors. It's dead simple!\n\n## Example + Making your own\nLet's look at a very simple spec for a circuit:\n\n\u003e Using Logisim and only NAND gates, implement an 8→3 encoder with input A[7:0] and output X[2:0].\n\nBased on this spec, we can tell that we should:\n\n1. Expect inputs to be one-hot\n2. Expect outputs to be the binary-encoded representation of that one-hot value\n\nGenerating all these cases by hand would be totally possible, in fact here \nthey are:\n\n```\nA[8] X[3]\n10000000 111\n01000000 110\n00100000 101\n00010000 100\n00001000 011\n00000100 010\n00000010 001\n00000001 000\n```\n\nNow let's look at the code to generate these:\n\n```python\n# 4\ndef TaskOneGenerator(input_case: InputOutputCase) -\u003e List[bool]:\n    flatInputBytes: list[bool] = flattenInputOutputCase(input_case)\n\n    counter = 0\n    for index, val in enumerate(flatInputBytes):\n        if val is True:\n            counter = 7 - index\n            break\n\n    return [bool(int(j)) for j in \"{0:03b}\".format(counter)]\n\n\ntask1 = TestVector(\n    [InputOutputShapeElement(label=\"A\", width=8)], # 1\n    [InputOutputShapeElement(label=\"X\", width=3)], # 2\n    TaskOneGenerator, # 4\n    create_one_hot_inputs, # 3\n    \"test_vectors/da1p1.txt\"\n)\n```\n\nYou can see this has codified the whole spec of the problem! We have the \ninput shape (1), the output shape (2), the spec for the inputs (3), and the \nspec for turning inputs into outputs (4)! This code will nicely and \nperfectly generate the test cases for the described problem.\n\n## More Examples\nPlease see main.py, it has 2 additional and more complex examples.\n\n## Contributions\nThis has been made for the Winter 2022 ECE M16 class at UCLA, and if you're \nin this class too, I'd love contributions with the rest of the generators! \nI haven't had time to make em yet but if you do, please please open a PR so \nwe can all benefit! The problem spec explicitly encourages us to share and \nwork together on test vectors, so this should be totally fair game! \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcobular%2Ftestvectorgenerator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcobular%2Ftestvectorgenerator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcobular%2Ftestvectorgenerator/lists"}