diff --git a/README.md b/README.md index 3a36d6c..7289432 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,27 @@ # In-Field Testing Using MISR +## Setup + +After cloning this repository, run: + +``` +git submodule init +git submodule update +``` + +This project uses [Nix](https://nixos.org) to manage reproducible programming environments. + +Run `nix develop` to enter a shell with all necessary software. + +If `nix` is not installed, follow this [guide](https://librelane.readthedocs.io/en/stable/installation/nix_installation/index.html). No need to clone `librelane` here, but it is good to set up the `extra-substituters` as described in the guide for using LibreLane in the future (for making layouts with SkyWater 130nm technology). + +## Usage + +Compile jpeg decoder core using `iverilog` and run RTL simulation of the jpeg decoder core using `vvp`: + +``` +nix develop +make +uv run jpeg_core_tb_run_plasma.py +``` + diff --git a/jpeg_core_tb_run_random.py b/jpeg_core_tb_run_plasma.py similarity index 97% rename from jpeg_core_tb_run_random.py rename to jpeg_core_tb_run_plasma.py index e617448..e864a95 100644 --- a/jpeg_core_tb_run_random.py +++ b/jpeg_core_tb_run_plasma.py @@ -56,8 +56,7 @@ def run_simulation(jpeg_path, ppm_path, vvp_path): """ Decode jpeg_path into ppm_path with vvp sim.vvp and return the result as a PIL Image. """ - assert os.path.exists(vvp_path), "sim.vvp not found — run 'make sim.vvp' first" - + result = subprocess.run( ['vvp', vvp_path, f'+infile={jpeg_path}', f'+outfile={ppm_path}'], capture_output=True, text=True, @@ -112,14 +111,15 @@ def main(): help='Plasma coarsest feature size in pixels (default 32)') parser.add_argument('--save-input', metavar='PATH', help='Save generated JPEG to this path') parser.add_argument('--save-output', metavar='PATH', help='Save RTL output PPM to this path') - parser.add_argument('--vvp-path', metavar='PATH', default='sim.vvp', - help='Path to compiled simulation (default: sim.vvp)') + parser.add_argument('--vvp-path', metavar='PATH', default='jpeg_core_tb.vvp', + help='Path to compiled simulation (default: jpeg_core_tb.vvp)') args = parser.parse_args() mcu, subsampling_str = (16, '4:2:0') if args.subsampling else (8, '4:4:4') assert args.width % mcu == 0, f"width {args.width} must be a multiple of {mcu} for {subsampling_str}" assert args.height % mcu == 0, f"height {args.height} must be a multiple of {mcu} for {subsampling_str}" + assert os.path.exists(args.vvp_path), f"{args.vvp_path} not found - run 'make' first" print(f"input: width={args.width} height={args.height} YCbCr={subsampling_str} q={args.quality} seed={args.seed}")