Compdigitec Labs

VCD dumping in Chisel 6.5 / svsim

By admin | November 1, 2024

Since Chisel 5, chiseltest (formerly known as chisel-testers2) is no longer supported and has been replaced with svsim in the default chisel-template. Unfortunately, the new system doesn’t provide an easy way to dump VCDs from tests.

On vanilla Chisel 6.5 this ended up requiring two separate hacks against EphemeralSimulator:

  1. https://github.com/edwardcwang/decoupled-serializer/blob/master/src/main/scala/VCDHackedEphemeralSimulator.scala#L44
    Inserting traceStyle = Some(verilator.Backend.CompilationSettings.TraceStyle.Vcd(traceUnderscore = true)) into the backendSpecificCompilationSettings of the DefaultSimulator.
  2. https://github.com/edwardcwang/decoupled-serializer/blob/master/src/main/scala/VCDHackedEphemeralSimulator.scala#L31
    The above was not enough as it added support for tracing but did not actually call the functions to enable & start the dumping.
    Hacking the simulate() method to insert a call to module.controller.setTraceEnabled(true) to actually enable the dump of the .vcd file.

Third bonus hack: use the local test_run_dir directory (from older versions of Chisel) instead of a temporary one which gets deleted.
https://github.com/edwardcwang/decoupled-serializer/blob/master/src/main/scala/VCDHackedEphemeralSimulator.scala#L61

See also:
https://github.com/chipsalliance/chisel/issues/4246

https://github.com/chipsalliance/chisel/issues/4203

https://github.com/chipsalliance/chisel/discussions/3957

Topics: Code | No Comments »

Dying SSD with “Media and Data Integrity Errors”

By admin | June 23, 2024

Dying SSD which caused system freezes, fsck issues, etc.

$ sudo smartctl -x /dev/sda
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.8.0-35-generic] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number:                       TEAM TM8FP6001T
Serial Number:                      112212210360617
Firmware Version:                   VC0S036I
PCI Vendor/Subsystem ID:            0x10ec
IEEE OUI Identifier:                0x00e04c
Controller ID:                      1
NVMe Version:                       1.4
Number of Namespaces:               1
Namespace 1 Size/Capacity:          1,024,209,543,168 [1.02 TB]
Namespace 1 Formatted LBA Size:     512
Local Time is:                      Sun Jun 23 02:15:18 2024 EDT
Firmware Updates (0x02):            1 Slot
Optional Admin Commands (0x0017):   Security Format Frmw_DL Self_Test
Optional NVM Commands (0x0054):     DS_Mngmt Sav/Sel_Feat Timestmp
Log Page Attributes (0x02):         Cmd_Eff_Lg
Maximum Data Transfer Size:         32 Pages
Warning  Comp. Temp. Threshold:     100 Celsius
Critical Comp. Temp. Threshold:     110 Celsius

Supported Power States
St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
 0 +     8.00W       -        -    0  0  0  0        0       0
 1 +     4.00W       -        -    1  1  1  1        0       0
 2 +     3.00W       -        -    2  2  2  2        0       0
 3 -   0.0300W       -        -    3  3  3  3     5000   10000
 4 -   0.0050W       -        -    4  4  4  4    54000   45000

Supported LBA Sizes (NSID 0x1)
Id Fmt  Data  Metadt  Rel_Perf
 0 +     512       0         0

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning:                   0x00
Temperature:                        53 Celsius
Available Spare:                    100%
Available Spare Threshold:          32%
Percentage Used:                    0%
Data Units Read:                    3,635,404 [1.86 TB]
Data Units Written:                 7,557,554 [3.86 TB]
Host Read Commands:                 122,761,256
Host Write Commands:                182,614,617
Controller Busy Time:               0
Power Cycles:                       1,816
Power On Hours:                     211
Unsafe Shutdowns:                   106
Media and Data Integrity Errors:    129
Error Information Log Entries:      0
Warning  Comp. Temperature Time:    0
Critical Comp. Temperature Time:    0

Error Information (NVMe Log 0x01, 8 of 8 entries)
No Errors Logged

Warning: NVMe Get Log truncated to 0x200 bytes, 0x034 bytes zero filled
Self-test Log (NVMe Log 0x06)
Self-test status: No self-test in progress
No Self-tests Logged

Topics: Linux | No Comments »

us-east-1e doesn’t have t3 instances

By admin | March 15, 2024

us-east-1e (although AWS may randomize zone mappings) doesn’t have t3 instances! This may cause the following error messages.

“The requested configuration is currently not supported. Please check the documentation for supported configurations”

“Your requested instance type (t3.large) is not supported in your requested Availability Zone (us-east-1e). Please retry your request by not specifying an Availability Zone or choosing us-east-1a, us-east-1b, us-east-1c, us-east-1d, us-east-1f”

Topics: Internet | No Comments »

ERRINFO_CLOSE_STACK_ON_DRIVER_FAILURE error in FreeRDP

By admin | April 8, 2023

xfreerdp /v:rdp_server_address /admin /network:auto /u:username /p:password

Connecting to a Windows 10 machine yielded the following error.

https://github.com/FreeRDP/FreeRDP/issues/6604 hints in https://github.com/FreeRDP/FreeRDP/issues/6604#issuecomment-746104066 that it might be an issue of hardware acceleration.

The solution is to disable RemoteFX for remote desktop.

[15:38:35:887] [24159:24160] [DEBUG][com.freerdp.core.rdp] - recv Set Error Info Data PDU (0x2F), length: 22
[15:38:35:887] [24159:24160] [INFO][com.freerdp.core] - ERRINFO_CLOSE_STACK_ON_DRIVER_FAILURE (0x00000011):The display driver in the remote session was unable to complete all the tasks required for startup.
[15:38:35:887] [24159:24160] [ERROR][com.freerdp.core] - rdp_set_error_info:freerdp_set_last_error_ex ERRINFO_CLOSE_STACK_ON_DRIVER_FAILURE [0x00010011]

Topics: Windows | No Comments »

Scala.js – Referring to non-existent class

By admin | September 9, 2021

Referring to non-existent class MyClass$
  called from JSClass$.jsMethod()void
  called from JSClass$.$js$exported$meth$jsMethod()java.lang.Object
  exported to JavaScript with @JSExport
involving instantiated classes:
  JSClass$
    exported to JavaScript with @JSExport
Cannot access module for non-module MyClass$
  called from JSClass$.jsMethod()void
  called from JSClass$.$js$exported$meth$jsMethod()java.lang.Object
  exported to JavaScript with @JSExport
involving instantiated classes:
  JSClass$
    exported to JavaScript with @JSExport

Related issue: https://github.com/scala-js/scala-js/issues/629

If the issue is coming from a shared module being used in both a Scala.js and JVM setting, the issue may be that the shared module is not being compiled for Scala.js. We can fix that as follows by compiling it for both. Mill example below:

object MyObject extends ScalaModule with ScalaJSModule with ScalafmtModule {
  // ...
}

// Instead of

object MyObject extends ScalaModule with ScalafmtModule {
  // ...
}

Topics: Code | No Comments »

Serving VNC via HTML5 using noVNC and x11vnc

By admin | July 22, 2021

# May need to set up x11vnc password beforehand!
# -forever and -loop are important to makes sure it keeps working
nohup x11vnc -create -forever -loop -usepw &

# noVNC
git clone https://github.com/novnc/noVNC.git --depth 2
cd noVNC

# Set up SSL
openssl req -x509 -nodes -newkey rsa:2048 -keyout novnc.pem -out novnc.pem -days 180

nohup ./utils/novnc_proxy --vnc localhost:5900 --cert novnc.pem --ssl-only --listen 443 &

Topics: (X)HTML, Internet, Linux | No Comments »

Accessing SQL databases from Scala

By admin | July 21, 2021

import scalikejdbc._
import scalikejdbc.scalikejdbcSQLInterpolationImplicitDef

// initialize JDBC driver & connection pool
Class.forName("org.postgresql.Driver")

scalikejdbc.ConnectionPool.singleton("jdbc:postgresql://localhost:5432/", "user", "abcdef888")

sql"""
create table members (
  id serial not null primary key,
  fav_num integer NOT NULL,
  name text NOT NULL
)
""".execute.apply()(scalikejdbc.AutoSession)

sql"""
INSERT INTO members (name, fav_num) VALUES ('Foo', 123)
""".execute.apply()(scalikejdbc.AutoSession)

sql"""
INSERT INTO members (name, fav_num) VALUES ('Bar', 456)
""".execute.apply()(scalikejdbc.AutoSession)

// http://scalikejdbc.org/documentation/operations.html
scalikejdbc.DB.readOnly { implicit session =>
  sql"select * from members".foreach { (rs: scalikejdbc.WrappedResultSet) =>
    println(rs.toMap())
  }
}

You can run the database with Docker (example) as follows:

docker run --name mypsql -e POSTGRES_USER=user -e POSTGRES_PASSWORD=abcdef888 -p 5432:5432 postgres:13.3

Reference instructions for connecting to the docker instance:

psql -h localhost -U user
\dt
select * from members;

Topics: Code | 1 Comment »

Local build in npm

By admin | May 24, 2021

npm install # Install dependencies
npm run build # Needs a like like "build": "tsc" in package.json. For TypeScript, just run tsc directly if missing
npm install -g # Installed compiled result to global packages

Topics: Code | No Comments »

Python classes, metaclasses, and instances at a glance

By admin | February 16, 2021

For more details: http://www.thedigitalcatonline.com/blog/2014/09/01/python-3-oop-part-5-metaclasses/

Topics: Code | 1 Comment »

git-strip-above

By admin | February 15, 2021

git format-patch $1..HEAD -o wip && git reset --hard $1

Topics: Code | 2 Comments »

If you found this article helpful or interesting, please help Compdigitec spread the word. Don’t forget to subscribe to Compdigitec Labs for more useful and interesting articles! « Older Entries