Skip to content

Defining ADC input voltages via input VCD file #575

@backtail

Description

@backtail

I have been unable to find a conclusive answer via official docs, source code, blog posts by enthusiasts, etc. whether I can define ADC input from a VCD file for a simulation or not, so that I can pass it with simavr path/to/elf -i input.vcd:

$timescale 1ms $end
$scope module logic $end
$var wire 16 ! adc0 $end
$upscope $end
$enddefinitions $end
#0
b0 !
#100
b1000 !
#200
b10000 !
#500
b100000 !

I am successfully simulating input pin changes by defining iogPORT_PINNUMBER variables, as suggested in this issue.

When looking at the implementation of the IO pins, I found this definition:

#define AVR_IOCTL_IOPORT_GETIRQ(_name) AVR_IOCTL_DEF('i','o','g',(_name))

That would suggest to me, that maybe this definition should make it possible to hook up external VCD changes to the internal ADC interrupts - if I can name the variables correctly.

#define AVR_IOCTL_ADC_GETIRQ AVR_IOCTL_DEF('a','d','c','0')

However, I don't get it to work with a file like above. That means either I am doing something wrong or it is not possible to do like this in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions