Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[issue#137]: Add mechanism for reset all flop of Sequential #302

Merged
merged 21 commits into from
May 18, 2023
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d71b57f
[issue#137]: Add mechanism for reset all flop of Sequential
RPG-coder-intc Mar 7, 2023
326f5ac
[issue#137] resetting flipflops for sequential via _Always constructor
RPG-coder-intc Mar 16, 2023
ca846e0
[issue#137] fixing reset arg for sequential and passing args to _always
RPG-coder-intc Mar 16, 2023
f086a4e
[issue#137] reordering args in _always
RPG-coder-intc Mar 16, 2023
a080a95
[issue#137] resolving override errors
RPG-coder-intc Mar 16, 2023
bf24cba
fix: resolving code conflict
RPG-coder-intc Mar 21, 2023
12fea90
Merge branch 'intel:main' into fix-issue-137
RPG-coder-intc Mar 21, 2023
c86e902
Merge branch 'intel:main' into fix-issue-137
RPG-coder-intc Apr 4, 2023
a229135
counter test for reset flipflops
RPG-coder-intc Apr 6, 2023
20127c2
resolving code_review
RPG-coder-intc Apr 6, 2023
94a99ea
transfering reset flipflop test cases to wintf
RPG-coder-intc Apr 13, 2023
d7f8ca6
[issue#137] resolving code reviews
RPG-coder-intc Apr 20, 2023
e4c4651
updating wintf tests for resetFlipflop
RPG-coder-intc Apr 20, 2023
48b9314
maintaining code quality
RPG-coder-intc Apr 20, 2023
fe7dc43
[issue-137] refining counter test
RPG-coder-intc Apr 20, 2023
ce86966
Merge branch 'intel:main' into fix-issue-137
RPG-coder-intc May 18, 2023
8e75df8
Resolving code reviews
RPG-coder-intc May 18, 2023
65bc5e3
Merge branch 'fix-issue-137' of https://github.com/RPG-coder-intc/roh…
RPG-coder-intc May 18, 2023
97c76d1
replace getReceiver() to receiver for perf boost
RPG-coder-intc May 18, 2023
f38e4d2
removing unused import
RPG-coder-intc May 18, 2023
9064935
removing unused class var
RPG-coder-intc May 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 28 additions & 4 deletions lib/src/modules/conditional.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import 'package:rohd/src/utilities/uniquifier.dart';
/// Represents a block of logic, similar to `always` blocks in SystemVerilog.
abstract class _Always extends Module with CustomSystemVerilog {
/// A [List] of the [Conditional]s to execute.
final List<Conditional> conditionals;
late final List<Conditional> conditionals;

/// A mapping from internal receiver signals to designated [Module] outputs.
final Map<Logic, Logic> _assignedReceiverToOutputMap = {};
Expand Down Expand Up @@ -267,14 +267,18 @@ class Sequential extends _Always {
/// The input clocks used in this block.
final List<Logic> _clks = [];

/// This sets the Sequential conditions to reset
mkorbel1 marked this conversation as resolved.
Show resolved Hide resolved
Logic? reset;
Map<Logic, Logic> resetVal = {};

/// Constructs a [Sequential] single-triggered by [clk].
Sequential(Logic clk, List<Conditional> conditionals,
{String name = 'sequential'})
: this.multi([clk], conditionals, name: name);
{String name = 'sequential', Logic? reset})
: this.multi([clk], conditionals, name: name, reset: reset);
RPG-coder-intc marked this conversation as resolved.
Show resolved Hide resolved

/// Constructs a [Sequential] multi-triggered by any of [clks].
Sequential.multi(List<Logic> clks, List<Conditional> conditionals,
{String name = 'sequential'})
{String name = 'sequential', this.reset})
RPG-coder-intc marked this conversation as resolved.
Show resolved Hide resolved
: super(conditionals, name: name) {
for (var i = 0; i < clks.length; i++) {
final clk = clks[i];
Expand Down Expand Up @@ -395,6 +399,26 @@ class Sequential extends _Always {
var anyClkInvalid = false;
var anyClkPosedge = false;

// This will reset the conditionals on setting the `reset` flag
if (reset != null) {
conditionals = [
If(
reset!,
then: [..._assignedReceiverToOutputMap.values.map((e) => e < 0)],

// then : [
// ..._assignedReceiverToOutputMap.values.map(
// (e) => e < resetVal[e]
// )
// ]

orElse: conditionals,
),
];
} else {
conditionals = conditionals;
}

for (var i = 0; i < _clks.length; i++) {
// if the pre-tick value is null, then it should have the same value as
// it currently does
Expand Down