Go to file
pca006132 c862650e0d Generate rust code 2020-07-29 14:28:02 +08:00
README Generate rust code 2020-07-29 14:28:02 +08:00
main.py Generate rust code 2020-07-29 14:28:02 +08:00
requirements.txt Uses virtualenv instead of nix python packages. 2020-07-28 16:32:52 +08:00
shell.nix Uses virtualenv instead of nix python packages. 2020-07-28 16:32:52 +08:00

README

A simple script for parsing TRM register definition...

Pipe the `pdftotext -layout` output to the python script stdin, and specify the
starting and ending address (absolute) of the registers.

This script can handle fields generation and description. This script is very
hacky, have a lot of assumptions on the format of the PDF, so use with care,
better check the output before you trust it.

Example:

pdftotext -f 1435 -l 1437 -layout ug585-Zynq-7000-TRM.pdf - | python main.py 0xF8F00000 0xF8F01FFF

#[repr(C)]
pub struct RegisterBlock {
    /// SCU Control Register
    pub scu_control_register: ScuControlRegister,
    /// SCU Configuration Register
    pub scu_configuration_register: ScuConfigurationRegister,
}

register!(scu_control_register, ScuControlRegister, RW, u32);
register_bit!(scu_control_register, ic_standby_enable, 6);
register_bit!(scu_control_register, scu_standby_enable, 5);
register_bit!(scu_control_register, force_all_device_to_po, 4);
register_bit!(scu_control_register, scu_speculative_linefil, 3);
register_bit!(scu_control_register, scu_rams_parity_enab, 2);
register_bit!(scu_control_register, address_filtering_enabl, 1);
register_bit!(scu_control_register, scu_enable, 0);

register!(scu_configuration_register, ScuConfigurationRegister, RO, u32);
register_bits!(scu_configuration_register, tag_ram_sizes,u8, 8, 15);
register_bits!(scu_configuration_register, cpus_smp,u8, 4, 7);
register_bits!(scu_configuration_register, cpu_number,u8, 0, 1);