Skip to main content

Convenient Register Access Library

Project description

coreali - Convenient Register Access Library

Generates Python code from a register model. This python code can the be used to access the registers of an FPGA, a MCU or another device which has a register map.

Installation

Coreali can be installed with pip by executing the following command

pip install coreali

How to use

The typical use case for coreali is:

  1. Make a register description of your system in systemRDL or any other supported format (ipxact) of the systemrdl-compiler
  2. Compile the register description with the systemrdl-compiler
  3. Generate the hierarchical register model class and objects with the coreali.RegisterModel
  4. Access the registers of your FPGA device with coreali.registerio

Quickstart - Logger example

  1. Create a register description of your system or module
mem log_mem {
    mementries = 64;
    memwidth = 8;
};

addrmap logger { 
	reg  {	
		desc = "Control register";
		field {sw = rw; hw = r;} ENABLE;
		field {sw = rw; hw = r;} TRIGGERED;
	} Ctrl;
	reg  {	
		desc = "Trigger configuration for channel 0 and 1";
		field {sw = rw; hw = r;} SW_TRIG;
		field {sw = rw; hw = r;} LEVEL[8];
	} Trig[2];
  	external log_mem LogMem[2];
};
  1. Import dependencies and compile register model with systemrdl-compiler
import sys
from systemrdl import RDLCompiler
import coreali 
import numpy as np
rdlc = RDLCompiler()
rdlc.compile_file("../systemrdl/logger.rdl")
root = rdlc.elaborate()
  1. Create the register model object
rio = coreali.registerio.RegIoNoHW(np.zeros([256], np.uint8()))
logger = coreali.RegisterModel(root, rio)

In this step the rio register input/output obkect is created. This object handles the low level access. The RegIoNoHW class allows to access virtual registers without having a hardware at hand. The XXXXX example shows how to create your own RegIo class to access your own hardware.TODO

  1. Use the generated register model
logger.Ctrl.read()
logger.LogMem.write(0,[1,2,3])
logger.LogMem.read()
logger.LogMem[1].write(0,[11,12,13])
print(logger)

The registers can now be read and written by hierarchically accessing them. With code completion of your python IDE the registers can be accessed conveniently.

When using the print function on a register, register node or address map all registers and field will be readout and printed as a string.

The full source code of this example can be found in examples/quickstart/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

coreali-0.1.0.tar.gz (23.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

coreali-0.1.0-py3-none-any.whl (14.8 kB view details)

Uploaded Python 3

File details

Details for the file coreali-0.1.0.tar.gz.

File metadata

  • Download URL: coreali-0.1.0.tar.gz
  • Upload date:
  • Size: 23.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for coreali-0.1.0.tar.gz
Algorithm Hash digest
SHA256 2a1acc296c4ab42de5d9f5b3459149dcb8539a1ba892830e6c309297e8986a2c
MD5 80df7b0f67a212e6bdec99be34ab05e2
BLAKE2b-256 d79d77880347d696dacd5e23302f620f572d71e7e43750ba142c09a498923f26

See more details on using hashes here.

File details

Details for the file coreali-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: coreali-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.21

File hashes

Hashes for coreali-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 502c259faaa681b5d022d4cb2148c59090c820bdebe1abd49bd20beb305c929f
MD5 40f91d7bc57aac5e584086603826f0d6
BLAKE2b-256 777ff9da458f7fcb9f5665a323e7d16aa9ea7929d0ba7deb3f2b31e73b017d59

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page