rohd_hcl 0.2.0 copy "rohd_hcl: ^0.2.0" to clipboard
rohd_hcl: ^0.2.0 copied to clipboard

The ROHD Hardware Component Library (ROHD-HCL): a collection of reusable, configurable ROHD components.

example/example.dart

// Copyright (C) 2023-2024 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// example.dart
// Example of how to use the library
//
// 2023 February 17
// Author: Max Korbel <max.korbel@intel.com>

// ignore_for_file: avoid_print

import 'package:rohd/rohd.dart';
import 'package:rohd_hcl/rohd_hcl.dart';

Future<void> main({bool noPrint = false}) async {
  // Build a module that rotates a 16-bit signal by an 8-bit signal, which
  // we guarantee will never see more than 10 as the rotate amount.
  final original = Logic(width: 16);
  final rotateAmount = Logic(width: 8);
  final mod = RotateLeft(original, rotateAmount, maxAmount: 10);
  final rotated = mod.rotated;

  // Do a quick little simulation with some inputs
  original.put(0x4321);
  rotateAmount.put(4);
  if (!noPrint) {
    print('Shifting ${original.value} by ${rotateAmount.value} '
        'yields ${rotated.value}');
  }

  // Generate verilog for it and print it out
  await mod.build();
  final sv = mod.generateSynth();
  if (!noPrint) {
    print(sv);
  }
}
4
likes
150
points
58
downloads

Publisher

unverified uploader

Weekly Downloads

The ROHD Hardware Component Library (ROHD-HCL): a collection of reusable, configurable ROHD components.

Homepage
Repository (GitHub)
View/report issues
Contributing

Documentation

Documentation
API reference

License

BSD-3-Clause (license)

Dependencies

collection, meta, rohd, rohd_vf

More

Packages that depend on rohd_hcl