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

Adjust Memory Model to use previousValue for sampling #41

Merged
merged 47 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
1bd1db9
sparse memory storage added with basic test
mkorbel1 Jun 12, 2023
b7bbec1
memory model and tests
mkorbel1 Jun 12, 2023
0448b14
move constant where its relevant
mkorbel1 Jun 12, 2023
b3b7186
update doc reference to memory models and storage
mkorbel1 Jun 12, 2023
aa70cc9
update readme
mkorbel1 Jun 12, 2023
af91ecc
starting point for apb bfm
mkorbel1 Jun 12, 2023
bee9705
move the mem hex reading into the abstract class
mkorbel1 Jun 12, 2023
a57dae8
Merge branch 'memmodel' into apbbfm
mkorbel1 Jun 12, 2023
0c4196d
basic first implementation done maybe
mkorbel1 Jun 12, 2023
b893b46
added tracking
mkorbel1 Jun 12, 2023
33d67c3
first time transactions run, but not working right yet
mkorbel1 Jun 12, 2023
b382ca8
got the ready and enable looking better in waves
mkorbel1 Jun 13, 2023
6c8b113
cleanup, checks, and strb fix
mkorbel1 Jun 13, 2023
d16d64b
timing bug fix, but strobe still broken
mkorbel1 Jun 13, 2023
1b99d4f
drop enable when empty
mkorbel1 Jun 13, 2023
5a1aebe
got strobe working sorta
mkorbel1 Jun 14, 2023
efec562
made error handling utilities part of storage for reusability
mkorbel1 Jun 14, 2023
c526966
Merge branch 'memmodel' into apbbfm
mkorbel1 Jun 14, 2023
93dda46
some progress
mkorbel1 Jun 14, 2023
ea2f299
make default not align addresses
mkorbel1 Jun 14, 2023
bda9e52
Merge branch 'memmodel' into apbbfm
mkorbel1 Jun 14, 2023
e708485
more tests with delays
mkorbel1 Jun 14, 2023
228184f
test tracker
mkorbel1 Jun 14, 2023
f91acf3
test response delays
mkorbel1 Jun 14, 2023
378a394
got errors working
mkorbel1 Jun 14, 2023
ba95996
some compliance checks
mkorbel1 Jun 14, 2023
d451e81
cleanup and docs
mkorbel1 Jun 14, 2023
3cfb129
Merge branch 'main' of https://github.com/intel/rohd-hcl into apbbfm
mkorbel1 Jun 14, 2023
269ce4d
update library
mkorbel1 Jun 14, 2023
2fee2a7
fix lint
mkorbel1 Jun 14, 2023
80a0be4
add utils export
mkorbel1 Jun 15, 2023
180b5c8
fix lint
mkorbel1 Jun 15, 2023
6e28c63
fix fifo to use previousValue
mkorbel1 Jun 16, 2023
3507065
adjust fifo to use updated rohd api
mkorbel1 Jun 16, 2023
be5de51
fix monitors to use previousValue and fix tracker to be more configur…
mkorbel1 Jun 17, 2023
bafd939
fix adder and update dependencies
mkorbel1 Jun 20, 2023
9a22ded
fix typo on tracker field for strobe
mkorbel1 Jun 20, 2023
b92a02c
put on posedges
mkorbel1 Jun 20, 2023
10645d2
fix dep overrides for now
mkorbel1 Jun 21, 2023
6bb7806
adjust sampling in memory model to use previousValue
mkorbel1 Aug 7, 2023
3fc454b
be more lenient if first edge
mkorbel1 Aug 7, 2023
bc12024
add todo for now
mkorbel1 Sep 19, 2023
7e2dd6c
Merge branch 'main' of https://github.com/intel/rohd-hcl into adjust_…
mkorbel1 Sep 26, 2023
57f2b03
Merge branch 'main' of https://github.com/intel/rohd-hcl into adjust_…
mkorbel1 Sep 26, 2023
b39d064
remove dupe file
mkorbel1 Sep 26, 2023
9ee26d8
remove wavedump code
mkorbel1 Sep 26, 2023
43ffbbb
allow default storage in completer agent
mkorbel1 Sep 26, 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
13 changes: 10 additions & 3 deletions lib/src/models/apb_bfm/abp_completer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,24 @@ class ApbCompleterAgent extends Agent {
final bool dropWriteDataOnError;

/// Creates a new model [ApbCompleterAgent].
///
/// If no [storage] is provided, it will use a default [SparseMemoryStorage].
ApbCompleterAgent(
{required this.intf,
required this.storage,
required Component parent,
MemoryStorage? storage,
this.selectIndex = 0,
this.responseDelay,
this.respondWithError,
this.invalidReadDataOnError = true,
this.dropWriteDataOnError = true,
String name = 'apbCompleter'})
: super(name, parent);
: storage = storage ??
SparseMemoryStorage(
addrWidth: intf.addrWidth,
dataWidth: intf.dataWidth,
),
super(name, parent);

@override
Future<void> run(Phase phase) async {
Expand All @@ -77,7 +84,7 @@ class ApbCompleterAgent extends Agent {
}

/// Calculates a strobed version of data.
LogicValue _strobeData(
static LogicValue _strobeData(
LogicValue originalData, LogicValue newData, LogicValue strobe) =>
[
for (var i = 0; i < strobe.width; i++)
Expand Down
16 changes: 9 additions & 7 deletions lib/src/models/memory_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,34 +58,36 @@ class MemoryModel extends Memory {

// on posedge of clock, sample write ports and save to memory
clk.posedge.listen((event) {
if (reset.value == LogicValue.one) {
if (reset.previousValue == LogicValue.one) {
storage.reset();
return;
}
for (final wrPort in wrPorts) {
if (!wrPort.en.value.isValid && !storage.isEmpty) {
if (!(wrPort.en.previousValue?.isValid ?? wrPort.en.value.isValid) &&
!storage.isEmpty) {
// storage doesnt have access to `en`, so check ourselves
storage.invalidWrite();
return;
}

if (wrPort.en.value == LogicValue.one) {
final addrValue = wrPort.addr.value;
if (wrPort.en.previousValue == LogicValue.one) {
final addrValue = wrPort.addr.previousValue!;

if (wrPort is MaskedDataPortInterface) {
storage.writeData(
addrValue,
[
for (var index = 0; index < dataWidth ~/ 8; index++)
wrPort.mask.value[index].toBool()
? wrPort.data.value.getRange(index * 8, (index + 1) * 8)
wrPort.mask.previousValue![index].toBool()
? wrPort.data.previousValue!
.getRange(index * 8, (index + 1) * 8)
: storage
.readData(addrValue)
.getRange(index * 8, (index + 1) * 8)
].rswizzle(),
);
} else {
storage.writeData(addrValue, wrPort.data.value);
storage.writeData(addrValue, wrPort.data.previousValue!);
}
}
}
Expand Down