Doubts about interrupt handler

21 views
Skip to first unread message

e.jo...@gmail.com

unread,
Mar 14, 2017, 10:18:26 AM3/14/17
to ArchC Development
Good morning,

I am studying about ArchC (2.4.1 version), SystemC and TLM, and trying to use a virtual platform to understand a little more about these languages. I decided to try implement the function "ac_behavior(intp, value, addr)" to be possible transmit interruptions to the processor. If I understood well, this function define a function called handle that is inside the ac_intr_handler.H file.

I know that these parameters will be set in a ac_tlm2_payload which will be sent to the processor that will receive this through a ac_tlm2_intr_port.

However, I would like to understand what the 'value' and 'addr' parameters mean, with the objective of implement the ac_behavior function and set the parameters properly.

Thanks for the help.

Elço João dos Santos Jr.

Rodolfo Azevedo

unread,
Mar 14, 2017, 12:27:49 PM3/14/17
to archc-dev
Hi Elço,

  We do not have any specific restriction about value and addr. They are fields available through the TLM2 package and we though this would be the most flexible way to allow future implementations.

  If you have only one kind of interrupt, you can disregard both parameters. If you have the interrupt number, you can use one of them with this meaning. But it is up to you to decide.

  Best regards,

      Rodolfo

--
You received this message because you are subscribed to the Google Groups "ArchC Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archc-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Rodolfo Jardim de Azevedo
http://www.ic.unicamp.br/~rodolfo
IC - University of Campinas - UNICAMP

e.jo...@gmail.com

unread,
Mar 15, 2017, 8:06:52 AM3/15/17
to ArchC Development
Hi Rodolfo, thanks for the reply.

I implemented the function ac_behavior similar to what is showed in the template file. Just a routine to wake up the CPU. Besides, I am transmitting a payload with data equals 1, to represent the action INTR_PROC_ON. The address of the interruption was disregard.

However, I am getting the error "ArchC Error: Segmentation fault.". I used the GDB to debug the code and discovered that the segmentation fault is occurring during the execution of b_transport function inside the file ac_tlm2_intr_port.cpp.
This is the GDB message:

Program received signal SIGSEGV, Segmentation fault.
0x0000000000485296 in ac_tlm2_intr_port::b_transport (this=<optimized out>, payload=..., time_info=...) at ac_tlm2_intr_port.cpp:88
88          handler.handle(data_p,addr);


Can you help me to figure out the reason of this error?


Elço João dos Santos Jr.
 

Em terça-feira, 14 de março de 2017 13:27:49 UTC-3, Rodolfo Jardim de Azevedo escreveu:
Hi Elço,

  We do not have any specific restriction about value and addr. They are fields available through the TLM2 package and we though this would be the most flexible way to allow future implementations.

  If you have only one kind of interrupt, you can disregard both parameters. If you have the interrupt number, you can use one of them with this meaning. But it is up to you to decide.

  Best regards,

      Rodolfo
2017-03-14 11:18 GMT-03:00 <e.jo...@gmail.com>:
Good morning,

I am studying about ArchC (2.4.1 version), SystemC and TLM, and trying to use a virtual platform to understand a little more about these languages. I decided to try implement the function "ac_behavior(intp, value, addr)" to be possible transmit interruptions to the processor. If I understood well, this function define a function called handle that is inside the ac_intr_handler.H file.

I know that these parameters will be set in a ac_tlm2_payload which will be sent to the processor that will receive this through a ac_tlm2_intr_port.

However, I would like to understand what the 'value' and 'addr' parameters mean, with the objective of implement the ac_behavior function and set the parameters properly.

Thanks for the help.

Elço João dos Santos Jr.

--
You received this message because you are subscribed to the Google Groups "ArchC Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to archc-dev+...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Liana Duenha

unread,
Mar 15, 2017, 10:13:44 AM3/15/17
to archc-dev
Hello,

The error may be occurring when you call the b_transport method, which is responsible for receiving and handling the interrupt inside the processor.
So, you must ensure that you have the correct address (or reference) for the corresponding ac_tlm2_intr_port component.

Please also check if the <proc>.H has the init code in the constructor: intr_port_hnd(*this,&wake), intr_port("intr_port", intr_port_hnd) (this code must be generated  automatically)
and ensure that you have implemented the method "handle" inside of your model.


The general steps to use interruption are:

If X is the initiator of an interruption, then it needs to know somehow the address Y of the tlm2_intr_port of the processor. 

X:
Y->b_transport (...)

Proc: (general code)
tlm2_intr_port::b_transport(...)
     handler.handle (data_p,addr);    
}


There is a macro inside the <proc>_ih_bhv_macros.H that convert "handle" to "ac_behavior" and you need to implement this method in

Proc: (model code), 
<proc>_intr_handlers.cpp
ac_behavior(...)
{
     ...
}

In your particular case, the method handle needs to write the corresponding value in the interruption register and notify an event (wake) to "turn-on" the processor. 
       intr_reg.write(value); 
       wake->notify(sc_core::SC_ZERO_TIME); 

Liana


To unsubscribe from this group and stop receiving emails from it, send an email to archc-dev+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
-------------------------------------------------------------------------
Liana Duenha

Faculdade de Computação - FACOM/UFMS
Website Institucional: www.facom.ufms.br


e.jo...@gmail.com

unread,
Mar 16, 2017, 4:34:43 PM3/16/17
to ArchC Development
Hi Liana, thanks for the reply.

I have been following the advices that you and Rodolfo gave to me, but this error still occurring.

Let me try to explain a little more:

In the main file of my platform, I connected the processor interrupt port to a sc_port<ac_tlm2_blocking_transport_if> that is defined in my initiator socket (IP) and is responsible to send the interruption to the processor.
I am trying to transmit a payload with a WRITE command and data_ptr equals 0xFFEE, that I transform to unsigned char* to pass the argument correctly.
Like I said, using the GDB I discovered that the "ArchC Error: Segmentation fault" is happening inside the function b_transport of the ac_tlm2_intr_port.cpp file, more specifically, on line 88 during the call of handler.hanle(data_p, addr).

However, doing a further debug using Valgrind, it's detected the following error: Address 0xffee is not stack'd, malloc'd or (recently) free'd.

So, I would like to understand more how ArchC manages the memory, because this error seems that the simulator is trying to access a position memory of my computer, and not a position memory of the processor model.
How can I solve this problem?

Thanks,

Elço João dos Santos Jr.

Reply all
Reply to author
Forward
0 new messages