ARM Technical Support Knowledge Articles

How can I write a LISA+ component that requests a file to load

Applies to: Fast Models


To create a component in LISA+ that requests and loads a file the component requires to have the follow sections in the LISA+ description defined:

1) Properties

The component requesting the file is required to have the following two properties set:

    executes_software = true;
    loadfile_extension = ".txt";

2) Behaviours

File loading is handled via the loadApplicationFile behaviour.

    behaviour loadApplicationFile(const string& filename)

This behaviour receives the path and file name for the file selected by the user in the debugger. The LISA+ language does not specify the functionality that this behaviour should contain, this is model dependant. 

   3) Resources (optional)

Steps 1 and 2 are enough to allow you to load a file at simulation start.  However, Model Debugger will not prompt for a file unless a register is specified as the Program Counter (PC) is also specified.  Registers are defined in the resources section of the model, and the following line of code can be sued to specify a register as the PC:

    REGISTER{type(int), bitwidth(32), is_program_counter(true)}  PC;

Attached to this article is a LISA+ description that implements the above functionality as an example. The loadApplicationFile behaviour opens the provided file and loads it contents into a memory .

The description of the LISA+ language can be found in the LISA+ Language for Fast Models Reference Manual

Attachments: file_open.lisa

Article last edited on: 2012-01-13 12:26:35

Rate this article

Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential