Memory Management

Today I implemented a Popup window that displays the contents of a Memory device. The view is like a typical hex memory dump of the data bytes against memory addresses.

You may also specify the size of the memory and the word width (8/16 bits).

Memory Manager

One of the challenges was how to present the data. First I used a grid of Labels or LineEdit nodes, but the LineEdit nodes have an undesirable minimum width that was too large. And there ended up with numerous nodes.

So the next idea was to simply use one Label and populate it with text. This made it easy to output the data and switch views between hex and binary.

But, it would be nice to be able to edit the memory values. This entailed the need to detect the mouse position and relate this to a memory address. I also changed the mouse cursor to a pointing hand since there was no highlighting going on.

I used a mono-spaced font, so this allows for consistent distances between points. Clicking on a data byte value opens a popup that allows for changing the data value.

First I created an edit box for entering the byte value in binary or hex. However, this didn’t seem right with only one character of hex to edit. Also, the entered values need to be validated for allowed values on each change.

A far simpler approach was taken where it was realized that there are only 16 possible byte values, and we may as well simply display the available choices in a grid of buttons. Furthermore, it is trivial to display the values as decimal, hex, and binary.

Oops! No, a 4-bit nibble has 16 possible values. I change this later on in the journey :-)

Memory value editor

Editing the value at address zero.

Pressing one of the buttons changes the value and closes the popup. Also, the current value button grabs focus.

This tool is only meant for very basic memory management. It’s likely, in the future to use say an external code editor to create the byte array. This data would be imported into a memory part. The data will be saved in the circuit with the memory part.

To do

  • Integrate the memory data with memory part

Comments Forum

More Devlog entries

Most recent first