Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
14 years ago

Difference between IORD_32DIRECT and IORD_ALTERA_AVALON_PIO_DATA

Hallo,

could someone explain me the difference between IORD_ALTERA_AVALON_PIO_DATA and IORD_32DIRECT?

When should I use which?

Thanks

Sim

5 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    IORD_ALTERA_AVALON_PIO_DATA reads the data from a PIO

    IORD_32DIRECT reads 32 bits from an adress (that can be a pio)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Ok. That means, if I use both commands for a PIO, they work similar. Right?

    But wherefrom does IORD_ALTERA_AVALON_PIO_DATA know the width of the data?

    I mean in the other case I specify 8, 16 or 32 Bit. And what does IORD_ALTERA_AVALON_PIO_DATA if the width is 33Bit for example?
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    from altera_avalon_pio_regs.h

    # define IOADDR_ALTERA_AVALON_PIO_DATA(base) __IO_CALC_ADDRESS_NATIVE(base, 0)

    # define IORD_ALTERA_AVALON_PIO_DATA(base) IORD(base, 0)

    # define IOWR_ALTERA_AVALON_PIO_DATA(base, data) IOWR(base, 0, data)

    # define IOADDR_ALTERA_AVALON_PIO_DIRECTION(base) __IO_CALC_ADDRESS_NATIVE(base, 1)

    # define IORD_ALTERA_AVALON_PIO_DIRECTION(base) IORD(base, 1)

    # define IOWR_ALTERA_AVALON_PIO_DIRECTION(base, data) IOWR(base, 1, data)

    # define IOADDR_ALTERA_AVALON_PIO_IRQ_MASK(base) __IO_CALC_ADDRESS_NATIVE(base, 2)

    # define IORD_ALTERA_AVALON_PIO_IRQ_MASK(base) IORD(base, 2)

    # define IOWR_ALTERA_AVALON_PIO_IRQ_MASK(base, data) IOWR(base, 2, data)

    # define IOADDR_ALTERA_AVALON_PIO_EDGE_CAP(base) __IO_CALC_ADDRESS_NATIVE(base, 3)

    # define IORD_ALTERA_AVALON_PIO_EDGE_CAP(base) IORD(base, 3)

    # define IOWR_ALTERA_AVALON_PIO_EDGE_CAP(base, data) IOWR(base, 3, data)

    # define IOADDR_ALTERA_AVALON_PIO_SET_BIT(base) __IO_CALC_ADDRESS_NATIVE(base, 4)

    # define IORD_ALTERA_AVALON_PIO_SET_BITS(base) IORD(base, 4)

    # define IOWR_ALTERA_AVALON_PIO_SET_BITS(base, data) IOWR(base, 4, data)

    # define IOADDR_ALTERA_AVALON_PIO_CLEAR_BITS(base) __IO_CALC_ADDRESS_NATIVE(base, 5)

    # define IORD_ALTERA_AVALON_PIO_CLEAR_BITS(base) IORD(base, 5)

    # define IOWR_ALTERA_AVALON_PIO_CLEAR_BITS(base, data) IOWR(base, 5, data)
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    sim, the register is always a 32 bits register

    if your pio has a 1 bit width the other bits are going to be zero
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    --- Quote Start ---

    sim, the register is always a 32 bits register

    if your pio has a 1 bit width the other bits are going to be zero

    --- Quote End ---

    That makes sense! Thank you.