{"id":20602459,"url":"https://github.com/augustunderground/hace","last_synced_at":"2026-03-19T16:39:23.636Z","repository":{"id":46435880,"uuid":"405905535","full_name":"AugustUnderground/hace","owner":"AugustUnderground","description":"Minimal interface to analog-circuit-library.","archived":false,"fork":false,"pushed_at":"2022-08-31T14:19:02.000Z","size":112,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-06T16:36:52.598Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Hy","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AugustUnderground.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-09-13T09:11:54.000Z","updated_at":"2022-10-23T04:31:42.000Z","dependencies_parsed_at":"2022-08-30T01:42:08.006Z","dependency_job_id":null,"html_url":"https://github.com/AugustUnderground/hace","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AugustUnderground/hace","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AugustUnderground%2Fhace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AugustUnderground%2Fhace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AugustUnderground%2Fhace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AugustUnderground%2Fhace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AugustUnderground","download_url":"https://codeload.github.com/AugustUnderground/hace/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AugustUnderground%2Fhace/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265688364,"owners_count":23811422,"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-16T09:13:55.135Z","updated_at":"2026-03-02T14:33:31.992Z","avatar_url":"https://github.com/AugustUnderground.png","language":"Hy","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HAC²E\n\nMinimal functional interface to [AC²E](https://github.com/matthschw/ace) for Hy.\n\n## Installation\n\nInstall with `pip`:\n\n```bash\n$ pip install git+https://github.com/augustunderground/hace.git\n```\n\nOr by cloning:\n\n```bash\n$ git clone https://github.com/augustunderground/hace.git\n$ pushd hace\n$ pip install .\n```\n\n### Dependencies\n\nMake sure [AC²E](https://github.com/matthschw/ace) and all dependencies are\ninstalled.\n\n### Backend Access\n\nOne way is to create a symlink from the `resource` directory of the AC²E\nrepository, which contains all the backends as git submodules, to `~/.ace`.\n`hace` will automatically look there if `pdk_path` and `ckt_path` are not\nspecified.\n\n```bash\n$ ln -s /path/to/ace/resource $HOME/.ace\n```\n\nIt should look something like this:\n\n```\n$HOME/.ace\n├── sky130-1V8\n│   ├── op1\n│   │   ├── input.scs\n│   │   └── properties.json\n│   ├── ...\n│   ├── pdk\n│   │   ├── cells\n│   │   │   ├── nfet_01v8\n│   │   │   │   ├── sky130_fd_pr__nfet_01v8__mismatch.corner.scs\n│   │   │   │   ├── sky130_fd_pr__nfet_01v8__tt.corner.scs\n│   │   │   │   └── sky130_fd_pr__nfet_01v8__tt.pm3.scs\n│   │   │   └── pfet_01v8\n│   │   │       ├── sky130_fd_pr__pfet_01v8__mismatch.corner.scs\n│   │   │       ├── sky130_fd_pr__pfet_01v8__tt.corner.scs\n│   │   │       └── sky130_fd_pr__pfet_01v8__tt.pm3.scs\n│   │   ├── models\n│   │   │   ├── all.scs\n│   │   │   ├── corners\n│   │   │   │   └── tt\n│   │   │   │       └── nofet.scs\n│   │   │   ├── parameters\n│   │   │   │   └── lod.scs\n│   │   │   └── sky130.scs\n│   │   ├── README.md\n│   │   └── tests\n│   │       ├── nfet_01v8_tt.scs\n│   │       └── pfet_01v8_tt.scs\n└── ...\n```\n\n#### Environment Variables\n\nAlternatively you can set environment variables, telling `hace` where to find\nthe pdk and testbenches.\n\n```bash\n$ export ACE_BACKEND=/path/to/ace/resource\n$ export ACE_PDK=/path/to/ace/resource/\u003ctech\u003e/pdk\n```\n\nWhere `\u003ctech\u003e` has to be a valid backend such as `xh035-3V3` for example.\n\n\n#### Explicit\n\nOtherwise paths have to be given explicitly to the `make_env` function via the\nkwargs `pdk_path` and `ckt_path`.\n\n## Getting Started\n\nPlease refer to the [AC²E](https://github.com/matthschw/ace) documentation for\nenvironment IDs and available backends. \n\n```python\nimport hace as ac\n\namp = ac.make_env('op2', 'xh035-3V3') \nsiz = ac.random_sizing(amp)\nres = ac.evaluate_circuit(amp, params = siz)\n```\n\n## API\n\nCreate an ace environment object:\n\n```python\namp = make_env( ace_id: str                         # ACE Environment ID\n              , ace_backend: str                    # ACE Backend ID\n              , pdk_path: Optional[List[str]] = []  # Path to ace backend\n              , ckt_path: Optional[str] = None      # Path to testbench\n              , sim_path: Optional[str] = None      # Path to store results\n              ) =\u003e amplifier                        # Returns ace env obj\n```\n\nWhere `ace_id` can be any supported AC²E environment id such as `op1 .. 9`,\n`nand4` or `st1`. And `ace_backend` should be a supported/installed backend,\nsuch as `sky130-1V8`.\n\n```python\nres = evaluate_circuit( amp                                   # Amplifier object\n                      , params: Optional[Dict[str, float]]    # Sizing parameters\n                      , blocklist: Optional[List[str]]        # List of blocked simulations\n                      ) =\u003e Dict[str, float]                   # Returns performance\n```\n\nThe `blocklist` argument may specify a list of simulations that will _not_ be\nperformed. To get a list of all available simulation analyses one may call\n\n```python\nsim = simulation_analyses(amp) =\u003e List[str]     # List of available analyses\n```\n\nTo get the simulation result of the previous run without simulating again:\n\n```python\nres = current_performance(amp) =\u003e Dict[str, float]\n```\n\nThe following functions can be used for accessing and indexing the Dictionaries:\n\n```python\nsizing_identifiers(amp) =\u003e List[str]        # Keys in optional params dict\nperformance_identifiers(amp) =\u003e List[str]   # Keys in current performance dict\n```\n\nGet random sizing parameters:\n\n```python\nrng = random_sizing(amp) =\u003e Dict[str, float]    # Random sizing parameters\n```\n\nGet sensible initial sizing parameters:\n\n```python\nsiz = initial_sizing(amp) =\u003e Dict[str, float]    # \"Good\" sizing parameters\n```\n\nSave the current state to a file (`.json`, `.yaml` and `.csv` are currently\nsupported):\n\n```python\ndump_state(amp, file_name=\"file.ext\") =\u003e Dict[str, float]     # Dumps current state\n```\n\nLoad a state (created with `dump_state`):\n\n```python\nload_state(amp, file_name: str) =\u003e Dict[str, float]           # Loads the given state \n```\n\n#### Concurrent / Parallel Programming\n\nThe concurrent API acts much the same as the default one. Create pooled\namplifier object:\n\n```python\namps = ac.make_env_pool( ace_ids: List[str],\n                       , ace_backends: List[str]\n                       , pdk_paths: Optional[List[List[str]]] = [[]]\n                       , ckt_paths: Optional[List[str]]       = []\n                       , sim_paths: Optional[List[str]]       = [\"/tmp\", ..] \n                       ) =\u003e amplifier_pool\n```\n\nThere is a short hand for creating a pool of the same environment.\n\n```python\nenvs = ac.make_same_env_pool( num_envs: int\n                            , ace_id: str,\n                            , ace_backends: str\n                            , pdk_paths: Optional[List[str]] = []\n                            , ckt_paths: Optional[str]       = []\n                            , sim_paths: Optional[str]       = \"/tmp\"\n                            ) =\u003e amplifier_pool\n```\n\nThe `AcePoolEnvironment` is a\n[namedtuple](https://docs.python.org/3/library/collections.html#collections.namedtuple)\nwith an `envs` and `pool` field. Where the former is a dict mapping an ID to an\nenvironment.\n\nParameters of environments in a pool can be set with a dict mapping an ID to a\ndict that is then passed to `set_parameters`.\n\n```python\nenvs = ac.set_parameters_pool( pool_env\n                             , pool_params dict[int, dict[str, float]]\n                             ) =\u003e pool_env\n```\n\nAn environment pool can be evaluated in a similar way.\n\n```python\nress = ac.evaluate_circuit_pool( pool_env\n                               , pool_params Optional[dict[int, dict[str, float]]] = {}\n                               , npar: int = len(os.shed_getaffinity(0)) // 2\n                               ) =\u003e simulation_results\n```\n\nSo far the `blocklist` is not supported in pooled environments.\n\n## Further Reading\n\nSee [ACE Documentation](https://matthschw.github.io/ace/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faugustunderground%2Fhace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faugustunderground%2Fhace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faugustunderground%2Fhace/lists"}