OVP Forums - A community of assistance, help, questions, and answers.
  FAQFAQ    SearchSearch      RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Log inLog in
Unable to build platform
Goto page Previous  1, 2
 
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> First time - readme
View previous topic :: View next topic  
Author Message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1646
Location: United Kingdom

PostPosted: Tue Dec 17, 2019 12:12 am    Post subject: Reply with quote

The module includes nets that are the UART Rx and Tx connections. These are monitored by the OP API calls in the harness so that when there is a change in the net values the callback triggers and prints the value on the net.
Back to top
View user's profile Send private message Visit poster's website
PriyamvadAcharya



Joined: 25 Sep 2019
Posts: 35

PostPosted: Tue Dec 17, 2019 12:54 am    Post subject: Reply with quote

DuncGrah wrote:
The module includes nets that are the UART Rx and Tx connections. These are monitored by the OP API calls in the harness so that when there is a change in the net values the callback triggers and prints the value on the net.


Ok
But we are writing into some addresses in application code not on nets.
In none of the file of example we are writing into nets.So how net callback is called?
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1646
Location: United Kingdom

PostPosted: Tue Dec 17, 2019 5:17 am    Post subject: Reply with quote

The application software is writing to the registers of a UART peripheral model that is causing the transmission of characters onto the Tx net. The writing onto this net by the peripheral model causes the callback in the test harness to be triggered and for the value written onto the net to be displayed.
Back to top
View user's profile Send private message Visit poster's website
PriyamvadAcharya



Joined: 25 Sep 2019
Posts: 35

PostPosted: Tue Dec 17, 2019 8:50 pm    Post subject: Reply with quote

DuncGrah wrote:
The application software is writing to the registers of a UART peripheral model that is causing the transmission of characters onto the Tx net. The writing onto this net by the peripheral model causes the callback in the test harness to be triggered and for the value written onto the net to be displayed.


Hello DuncGraph,
If the application software is writing to the registers of a UART peripheral model then how the characters are written to Tx net.

Are bits of registers connected to net?
Can we provide address to nets?

Thanks,
Priyamvad
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1646
Location: United Kingdom

PostPosted: Wed Dec 18, 2019 12:30 am    Post subject: Reply with quote

Hi, Sorry but I am not sure what you are wanting to know? The peripheral models represent real hardware with registers that are memory mapped and accessed by application software running on a processor. The other features of the hardware are also modelled.
There are peripheral modelling APIS PPM and BHM and there are test bench/harness APIs OP that allow you to create almost anything you want.
Back to top
View user's profile Send private message Visit poster's website
PriyamvadAcharya



Joined: 25 Sep 2019
Posts: 35

PostPosted: Wed Dec 18, 2019 12:46 am    Post subject: Reply with quote

DuncGrah wrote:
Hi, Sorry but I am not sure what you are wanting to know? The peripheral models represent real hardware with registers that are memory mapped and accessed by application software running on a processor. The other features of the hardware are also modelled.
There are peripheral modelling APIS PPM and BHM and there are test bench/harness APIs OP that allow you to create almost anything you want.


Can we use PPM API in application code to write to nets?

Thanks,
Priyamvad
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1646
Location: United Kingdom

PostPosted: Wed Dec 18, 2019 12:50 am    Post subject: Reply with quote

No, please read the manuals!
Back to top
View user's profile Send private message Visit poster's website
PriyamvadAcharya



Joined: 25 Sep 2019
Posts: 35

PostPosted: Wed Dec 18, 2019 5:16 am    Post subject: Reply with quote

DuncGrah wrote:
No, please read the manuals!


Hello DuncGraph,

If we want to connect multiple peripheral in OVP,then how can we do it?

I am explaining above question

Suppose if have two peripherals GPIO and PWM,then how can we connect GPIO output pins to PWM input pins ,then how can we achieve this in OVP environment ?

Hope you understand my question

With Regards,
Priyamvad
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1646
Location: United Kingdom

PostPosted: Wed Dec 18, 2019 7:09 am    Post subject: Reply with quote

Sorry, I do not understand how it is not clear how you would do this?

You just described two peripherals, one is a GPIO and one is a PWM. Both would have registers so that application software on a processor can read/write them. The GPIO has a net to represent the GPIO signals and the PWM has a net to represent the PWM signal. In a module instance the two peripherals are connected, using a net, the GPIO output to the PWM input.

Here is the trivial example you are talking about. you need to create a local VLNV library containing the peripherals PWM and GPIO and the module test containing the following code

GPIO pse.tcl file
Code:
imodelnewperipheral -name gpio -imagefile pse.pse -library peripheral -vendor imperas.ovpworld.org -version 1.0

imodeladdbusslaveport  -name bport -mustbeconnected -size 0x100

imodeladdaddressblock  -name ab -port bport -size 0x100 -offset 0 -width 32

imodeladdmmregister -addressblock bport/ab -name datain -width 32 -offset 0 -access r
imodeladdmmregister -addressblock bport/ab -name dataout -width 32 -offset 4 -access w -writefunction wrData

imodeladdnetport -type input  -name gpio_in -updatefunction gpio_in_change
imodeladdnetport -type output -name gpio_out


GPIO gpio.user.c file
Code:
#define PREFIX "GPIO"

//////////////////////////////// Callback stubs ////////////////////////////////

PPM_NET_CB(gpio_in_change) {
    // update data register with input value
   bhmMessage("I", PREFIX, "gpio_in changed 0x%08x->0x%08x", bport_ab_data.datain.value, (Uns32) value);
    bport_ab_data.datain.value = (Uns32) value;
}

PPM_REG_WRITE_CB(wrData) {
    *(Uns32*)user = data;

   bhmMessage("I", PREFIX, "Write Data 0x%08x", data);

    // write data to pwm net
   ppmWriteNet(handles.gpio_out, data);
}


PWM pse.tcl file
Code:
imodelnewperipheral -name pwm -imagefile pse.pse -library peripheral -vendor imperas.ovpworld.org -version 1.0

imodeladdbusslaveport  -name bport -mustbeconnected -size 0x100

imodeladdaddressblock  -name ab -port bport -size 0x100 -offset 0 -width 32

imodeladdmmregister -addressblock bport/ab -name datain -width 32 -offset 0 -access r
imodeladdmmregister -addressblock bport/ab -name dataout -width 32 -offset 4 -access w -writefunction wrData

imodeladdnetport -type input  -name pwm_in -updatefunction pwm_change
imodeladdnetport -type output -name pwm_out


PWM pwm.user.c file
Code:
#define PREFIX "PWM"

//////////////////////////////// Callback stubs ////////////////////////////////

PPM_NET_CB(pwm_change) {
    bhmMessage("I", PREFIX, "pwm_in changed 0x%08x->0x%08x", bport_ab_data.datain.value, (Uns32) value);

    // update data register with input value
   bport_ab_data.datain.value = (Uns32) value;
}

PPM_REG_WRITE_CB(wrData) {
    *(Uns32*)user = data;

   bhmMessage("I", PREFIX, "Write Data 0x%08x", data);

    // write data to pwm net
   ppmWriteNet(handles.pwm_out, data);
}


HW module.op.tcl file
Code:
ihwnew -name test  \
                -vendor imperas.ovpworld.org  \
                -library module  \
                -version 1.0

  ihwaddbus -instancename bus1 -addresswidth 32

  ihwaddprocessor  \
                -instancename cpu0  \
                -type arm \
                -vendor arm.ovpworld.org \
                -library processor \
                -defaultsemihost \
            -variant ARM7TDMI

    ihwconnect -instancename cpu0  \
                -busmasterport INSTRUCTION  \
                -bus bus1

    ihwconnect -instancename cpu0  \
                -busmasterport DATA  \
                -bus bus1

  ihwaddmemory -instancename memory1 \
                -type ram

    ihwconnect -instancename memory1  \
                -busslaveport sp1  \
                -bus bus1  \
                -loaddress 0x00000000  \
                -hiaddress 0x1fffffff

  ihwaddnet -instancename netConnect


  ihwaddperipheral -instancename gpio  \
                -vendor imperas.ovpworld.org \
                -type GPIO

  ihwconnect -instancename gpio  \
                -busslaveport bport  \
                -bus bus1  \
                -loaddress 0x20000000  \
                -hiaddress 0x200000ff

  ihwconnect -instancename gpio  \
                -netport gpio_out  \
                -net netConnect  \

  ihwaddperipheral -instancename pwm  \
                -vendor imperas.ovpworld.org \
                -type PWM

  ihwconnect -instancename pwm  \
                -busslaveport bport  \
                -bus bus1  \
                -loaddress 0x30000000  \
                -hiaddress 0x300000ff

  ihwconnect -instancename pwm  \
                -netport pwm_in  \
                -net netConnect  \

  ihwaddmemory -instancename memory2  \
                -type ram

    ihwconnect -instancename memory2  \
                -busslaveport sp1  \
                -bus bus1  \
                -loaddress 0x40000000  \
                -hiaddress 0xffffffff



Test Application (using ARM ARM7TDMI) that write to the GPIO data out register and reads from the PWM data in register.

Code:
#include <stdio>
#include <stdlib>


int main(int argc, char *argv[]) {

    printf("Write GPIO Out (0xaa55aa55)\n");
    *(unsigned int *) 0x20000004 = 0xaa55aa55;
    printf("Read PWM In\n");
   unsigned int data = *(unsigned int *) 0x30000000;
    printf("PWM Value 0x%08x\n", data);


    return 0;
}


Running the test using
Code:
harness.exe --vlnvroot /work/lib/ImperasLib --modulename test --program application/application.ARM7TDMI.elf  --monitornets --modeldiags 0xff


and I see the output showing the GPIO output net changing causing a change to the PWM input and reading this value.

Quote:
Write GPIO Out (0xaa55aa55)
Info (PP_WRR) PSE test/gpio: write register 'ab_dataout' = 0xaa55aa55
Info (GPIO) test/gpio: Write Data 0xaa55aa55
Info (OP_NWR) GlobalTime:0.001000 LocalTime:0.000011 Net:test/netConnect 0 => 2857740885
Info (PP_INT) NetPort test/pwm/pwm_in=2857740885 (0xaa55aa55)
Info (PWM) test/pwm: pwm_in changed 0x00000000->0xaa55aa55
Read PWM In
Info (PP_RDR) PSE test/pwm: read register 'ab_datain' = 0xaa55aa55
PWM Value 0xaa55aa55
Back to top
View user's profile Send private message Visit poster's website
PriyamvadAcharya



Joined: 25 Sep 2019
Posts: 35

PostPosted: Wed Dec 18, 2019 8:59 pm    Post subject: GPIO peripheral modelling Reply with quote

Hello DuncGraph,

How can we drive input pins of gpio peripheral from application layer code if we are not using any external hardware.

With Regards,
Priyamvad
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1646
Location: United Kingdom

PostPosted: Thu Dec 19, 2019 12:14 am    Post subject: Reply with quote

Application code can only access memory mapped spaces, so to generate signals into the GPIO you must have another device to drive these GPIO inputs.

You can create a test harness to do this as well, but this is independent to application software.
Back to top
View user's profile Send private message Visit poster's website
PriyamvadAcharya



Joined: 25 Sep 2019
Posts: 35

PostPosted: Thu Dec 19, 2019 1:44 am    Post subject: GPIO peripheral modelling Reply with quote

DuncGrah wrote:
Application code can only access memory mapped spaces, so to generate signals into the GPIO you must have another device to drive these GPIO inputs.

You can create a test harness to do this as well, but this is independent to application software.


Hello DuncGraph,

I have gone through harness in Examples/SimulationControl/monitoringNets.
In harness there is net callback which gets called when there is change in net value but how that net callback gets called I don't understand?

If I want to write on bus slave port address from application layer code and then registering a callback in peripheral model code when a write operation occurred on bus slave port address.Can we do this?
Back to top
View user's profile Send private message
PriyamvadAcharya



Joined: 25 Sep 2019
Posts: 35

PostPosted: Thu Dec 19, 2019 1:53 am    Post subject: GPIO peripheral modelling Reply with quote

Hello DuncGraph,

In Examples/SimulationControl/monitoringNets example,application code is writing and reading UART registers.

In harness.c file we have net callback which gets called when there is change in UART Tx and Rx net values.

So my quey is that if we are performing read and write operation on UART registers in application layer code,how net callback in harness.c gets called?

With Regards,
Priyamvad
Back to top
View user's profile Send private message
DuncGrah
OVP Technologist
OVP Technologist


Joined: 27 Feb 2008
Posts: 1646
Location: United Kingdom

PostPosted: Thu Dec 19, 2019 2:16 am    Post subject: Reply with quote

this is already answered previoulsy!
Quote:
The module includes nets that are the UART Rx and Tx connections. These are monitored by the OP API calls in the harness so that when there is a change in the net values the callback triggers and prints the value on the net.

I am not sure how to describe this more clearly? Let me try once more...
In the harness opNetNext is used to find each of the nets that are present in the hardware module. then opNetWriteMonitorAdd is used to register the callback netCallback on the net that is found. This means that when the simulator sees that the net is written to, it calls the registerered callback.

Quote:
If I want to write on bus slave port address from application layer code and then registering a callback in peripheral model code when a write operation occurred on bus slave port address.Can we do this?


Yes, this is how a peripheral model works. You can register a callback across the complete size of the bus slave port or you can add registers into the bus slave port each with individual callbacks registered. Please read the peripheral modeling documentation.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Open Virtual Platforms Forum Index -> First time - readme All times are GMT - 8 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Information regarding OVP © 2008-2022 Imperas Software