Comments (3)
The values should be zero-extended; if Bluesim is not doing that, that's a bug. Your example is showing a bug specifically for reading in "wide" data (width > 64), but it would be worth checking the behavior for all the types that Bluesim supports: tUInt8
(for bit vectors up to width 8), tUInt32
(up to 32), tUInt64
(up to 64), and tUWide
(65+). Your example is not predictable -- sometimes the values in memory are already zero, so no error is reported -- so I'm unsure how we can add it to the testsuite. Also, we should test the situation when too many digits are provided -- Bluesim should at least report a warning, and it shouldn't overflow the storage and keep writing the digits into memory (but, again, I'm unsure how to test that). We should at least do a manual inspection of the Bluesim code, though.
The code for reading in a memhex file is in bsc/src/bluesim/mem_file.cxx
, specifically in the overloaded functions parse_hex
and parse_bin
(as declared in the header bs_mem_file.h
). These are overloaded for each the data types (tUInt8, tUInt32, tUInt64, and tUWide). Wide data is an array of unsigned int
. For parsing in wide data, the function goes to the last digit in the string and works its way to front; it accumulates the value for each unsigned int
and then writes it to the place in the array. If there is not a full word of digits left at the end, the code writes the value to the full word -- so it is zero-extending up to the word boundary. The problem is that there may be more words in the wide value, and nothing writes zeros into those final words.
I would guess that, at line 649 in mem_file.cxx
(for parsing hex) and line 591 (for parsing binary), we should adjust/add something like this (note the addition of ++
in the partial word assignment):
// write partial word at end
if (idx != 0)
(*value)[word++] = x;
// zero extend any unspecified words
while (word < (data_bits % WORD_SIZE))
(*value)[word++] = 0;
from bsc.
FYI, some testing of RegFile load for Bluesim happens in bsc.bluesim/misc/
in the files WideRF.bsv
, WindowsRF.bsv
, and SparseRF.bsv
. I would guess that tests for fewer and greater digits (for bin and hex, and for each of the data types) would go in that directory as well.
from bsc.
FWIW, I believe it already does complain if you provide too many digits.
from bsc.
Related Issues (20)
- `-dparsed` produces invalid BSV module function that takes another module as an argument HOT 2
- Missing `Ord Bool` instance HOT 7
- Static check of file descriptor argument to tasks like $fgetc HOT 3
- Testsuite reports an error getting BSC version HOT 2
- Internal Compiler Error when quoting a character value. HOT 4
- Bluesim's symbol-probing interface has wrong values for FIFO
- Unresolved numeric contexts that should be resolvable HOT 6
- Verilog import fails in macro substitution HOT 2
- Unexpected syntax error HOT 1
- expandPorts.tcl has hardcoded paths which do not exist. HOT 1
- Unexpected behavior in Stmt sequence when using par HOT 2
- Bluesim divide-by-zero behavior is inconsistent on arm64 HOT 2
- Type synonyms with phantom parameters can lead to strange behaviors (E.g., compiler hang) HOT 4
- doc example for mkUniqueWrapper2 HOT 7
- -remove-unused-modules flag doesn't work with mkProbe module provided in std library HOT 2
- Failures with compilation on raspberry-pi 5 HOT 4
- GCC 14 emits extra warnings HOT 1
- Github's macos-11 runner is going away HOT 1
- [Bluesim] Simulation executable fails with `undefined symbol: _Z21vcd_write_scope_startP9tSimStatePKc` HOT 9
- `sqrtFP` is incorrect HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bsc.