Skip to content

Conversation

@oharboe
Copy link
Collaborator

@oharboe oharboe commented Oct 27, 2025

@povik Is there a reasonable way to implement such a SRAM mocking feature?

set size [memory_get $module $mem SIZE]

if {$size > $::env(SYNTH_MEMORY_MAX_BITS)} {
memory_set $module $mem SIZE 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@oharboe Is memory_set a hypothetical command?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see there are other dreamed up commands. Let me see if this can be implemented using real commands

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. In ChatGPT's defense it did say that it dreamt up these commands and then it looked for alternatives.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I offer this for testing:

memory_collect
foreach path [tee -q -s result.string select -list t:\$mem_v2] {
	set index [string first "/" $path]
	set module [string range $path 0 [expr {$index - 1}]]
	set instance [string range $path [expr {$index + 1}] end]

	set width [rtlil::get_param -uint $module $instance WIDTH]
	set size [rtlil::get_param -uint $module $instance SIZE]
	set nbits [expr $width * $size]
	puts "Memory $path has dimensions $size x $width = $nbits"
	if {$nbits > $::env(SYNTH_MEMORY_MAX_BITS)} {
		rtlil::set_param -uint $module $instance SIZE 1
		puts "Shrunk memory $path from $size rows to 1"
	}
}

@oharboe
Copy link
Collaborator Author

oharboe commented Oct 27, 2025

@povik Mysterious error:

make DESIGN_CONFIG=designs/sky130hd/microwatt/config.mk synth
7. Executing MEMORY_COLLECT pass (generating $mem cells).
aminfr' which is not allowed in RTLIL identifiers string '$paramod$5409023ed62e51a90c7a1a5e2fb5908f52c323ea
Command exited with non-zero status 1
Elapsed time: 0:25.30[h:]min:sec. CPU time: user 25.08 sys 0.16 (99%). Peak memory: 149052KB.
make[1]: *** [Makefile:262: do-yosys] Error 1
make: *** [Makefile:272: results/sky130hd/microwatt/base/1_2_yosys.v] Error 2

@povik
Copy link
Contributor

povik commented Oct 27, 2025

I've found the message template in Yosys. It warns about a special character but at the same time it prints the string containing the special character without escaping hence the mangled output.

log_error("Found control character or space (0x%02x) in string '%s' which is not allowed in RTLIL identifiers\n", *c, p);

I'll take a look to see how to fix the script.

@oharboe
Copy link
Collaborator Author

oharboe commented Oct 28, 2025

@povik Purely for my planning purposes, how long do you think you'll need to see if there's a fix for this PR? Days, weeks, months?

If it is very far out, then I think I should close the issue and re-open when we have what we need.

@povik
Copy link
Contributor

povik commented Oct 28, 2025

@oharboe a day or two

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants