{"id":24773019,"url":"https://github.com/definev/n2t_hdl","last_synced_at":"2025-03-23T21:14:45.281Z","repository":{"id":226897761,"uuid":"767174969","full_name":"definev/n2t_hdl","owner":"definev","description":"A library for parsing HDL code.","archived":false,"fork":false,"pushed_at":"2024-04-15T02:22:25.000Z","size":52,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-17T00:02:42.998Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/definev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2024-03-04T20:44:59.000Z","updated_at":"2024-04-18T18:45:07.469Z","dependencies_parsed_at":"2024-04-18T18:44:59.667Z","dependency_job_id":null,"html_url":"https://github.com/definev/n2t_hdl","commit_stats":null,"previous_names":["definev/n2t_hdl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/definev%2Fn2t_hdl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/definev%2Fn2t_hdl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/definev%2Fn2t_hdl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/definev%2Fn2t_hdl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/definev","download_url":"https://codeload.github.com/definev/n2t_hdl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245168905,"owners_count":20571804,"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":"2025-01-29T04:35:19.974Z","updated_at":"2025-03-23T21:14:45.213Z","avatar_url":"https://github.com/definev.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"A HDL parser for the [HDL Language]() used in the [Nand2Tetris](https://www.nand2tetris.org/) course. The parser is written in Python and is used to parse HDL files and generate a JSON representation of the HDL file. The JSON representation can then be used to generate a graphical representation of the HDL file.\n\n## Sample\n```\n// This file is part of www.nand2tetris.org\n// and the book \"The Elements of Computing Systems\"\n// by Nisan and Schocken, MIT Press.\n// File name: projects/02/ALU.hdl\n/**\n * ALU (Arithmetic Logic Unit):\n * Computes out = one of the following functions:\n *                0, 1, -1,\n *                x, y, !x, !y, -x, -y,\n *                x + 1, y + 1, x - 1, y - 1,\n *                x + y, x - y, y - x,\n *                x \u0026 y, x | y\n * on the 16-bit inputs x, y,\n * according to the input bits zx, nx, zy, ny, f, no.\n * In addition, computes the two output bits:\n * if (out == 0) zr = 1, else zr = 0\n * if (out \u003c 0)  ng = 1, else ng = 0\n */\n// Implementation: Manipulates the x and y inputs\n// and operates on the resulting values, as follows:\n// if (zx == 1) sets x = 0        // 16-bit constant\n// if (nx == 1) sets x = !x       // bitwise not\n// if (zy == 1) sets y = 0        // 16-bit constant\n// if (ny == 1) sets y = !y       // bitwise not\n// if (f == 1)  sets out = x + y  // integer 2's complement addition\n// if (f == 0)  sets out = x \u0026 y  // bitwise and\n// if (no == 1) sets out = !out   // bitwise not\n\nCHIP ALU {\n    IN  \n        x[16], y[16],  // 16-bit inputs        \n        zx, // zero the x input?\n        nx, // negate the x input?\n        zy, // zero the y input?\n        ny, // negate the y input?\n        f,  // compute (out = x + y) or (out = x \u0026 y)?\n        no; // negate the out output?\n    OUT \n        out[16], // 16-bit output\n        zr,      // if (out == 0) equals 1, else 0\n        ng;      // if (out \u003c 0)  equals 1, else 0\n\n    PARTS:\n    //// Pre-processing\n    Mux16(a=x, b[0..15]=false, sel=zx, out=zxx);\n    Not16(in=zxx, out=nxx);\n    Mux16(a=zxx, b=nxx, sel=nx, out=px);\n\n\n    Mux16(a=y, b[0..15]=false, sel=zy, out=zyy);\n    Not16(in=zyy, out=nyy);\n    Mux16(a=zyy, b=nyy, sel=ny, out=py);\n\n    //// Compute\n    And16 (a=px, b=py, out=andout);\n    Add16 (a=px, b=py, out=addout);\n    Mux16 (a=andout, b=addout, sel=f, out=pout);\n\n    //// Post-processing\n    Not16 (in=pout, out=notpout);\n    Mux16 (a=pout, b=notpout, sel=no, out=out,out[15]=ng, out[0..7]=zrLow, out[8..15]=zrHigh);\n\n    //// Flag reasoning\n    Or8Way (in=zrLow, out=zrLowOut);\n    Or8Way (in=zrHigh, out=zrHighOut);\n    Or (a=zrLowOut, b=zrHighOut, out=zrOut);\n    Not (in=zrOut, out=zr);\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefinev%2Fn2t_hdl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefinev%2Fn2t_hdl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefinev%2Fn2t_hdl/lists"}