Demo Stress HW Mappers for Zynq target.

parent f9341e2a
TASTE-Dataview DEFINITIONS ::= BEGIN
-- In this ACN model, you can specify custom binary encoding rules for
-- your data types. For example if you require a specific memory layout
-- for a record, or need to add padding fields, define endianness, etc.
-- you can do that with ACN. Refer to the ACN user manual for details.
-- TASTE-Boolean []
END
TASTE-Dataview DEFINITIONS ::=
BEGIN
IMPORTS T-Int32, T-UInt32, T-Int8, T-UInt8, T-Boolean FROM TASTE-BasicTypes;
MyInt ::= INTEGER (0 .. 20)
My2ndInt ::= MyInt ( 1 .. 18)
TypeEnumerated ::= ENUMERATED {
red(0),
green(1),
blue(2)
}
T-STRING ::= OCTET STRING (SIZE(16))
T-ARR ::= SEQUENCE (SIZE (6)) OF INTEGER (0..32764)
TypeNested ::= SEQUENCE {
intVal INTEGER(0..10),
int2Val INTEGER(-10..10),
int3Val MyInt (10..12),
intArray SEQUENCE (SIZE (10)) OF INTEGER (0..3),
octStrArray SEQUENCE (SIZE (10)) OF OCTET STRING (SIZE(12)),
boolArray SEQUENCE (SIZE (10)) OF T-Boolean,
enumArray SEQUENCE (SIZE (10)) OF TypeEnumerated,
enumValue TypeEnumerated,
enumValue2 ENUMERATED {
truism(0),
falsism(1)
},
label OCTET STRING (SIZE(8)),
bAlpha T-Boolean,
bBeta T-Boolean,
sString T-STRING,
arr T-ARR
}
-- Simple types:
-- MyInteger ::= INTEGER (0..255)
-- MyBool ::= BOOLEAN
-- MyEnum ::= ENUMERATED { hello, world, how-are-you }
-- Complex types:
-- MySeq ::= SEQUENCE {
-- input-data MyInteger,
-- output-data MyInteger,
-- validity ENUMERATED { valid, invalid }
-- }
--
-- MyChoice ::= CHOICE {
-- a BOOLEAN,
-- b MySeq
-- }
--
-- MySeqOf ::= SEQUENCE (SIZE (2)) OF MyEnum
--
-- MyOctStr ::= OCTET STRING (SIZE (3))
--
-- -- You can also declare constants
-- myVar MySeqOf ::= { hello, world }
END
---------------------------------------------------
-- AADL2.2
-- TASTE type deploymentview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE deploymentview::DV::Node2
PUBLIC
WITH Taste;
WITH Deployment;
WITH TASTE_DV_Properties;
WITH deploymentview::DV;
WITH Memory_Properties;
WITH ARINC653;
PROCESS zynq_partition
END zynq_partition;
PROCESS IMPLEMENTATION zynq_partition.others
END zynq_partition.others;
END deploymentview::DV::Node2;
PACKAGE deploymentview::DV
PUBLIC
WITH interfaceview::IV::Calling;
WITH interfaceview::IV::FunctionC;
WITH interfaceview::IV::FunctionSimulink;
WITH ocarina_processors_arm;
WITH deploymentview::DV::Node2;
WITH Taste;
WITH Deployment;
WITH interfaceview::IV;
WITH TASTE_DV_Properties;
SYSTEM Node2
END Node2;
SYSTEM IMPLEMENTATION Node2.others
SUBCOMPONENTS
IV_Calling : SYSTEM interfaceview::IV::Calling::Calling.others {
Taste::FunctionName => "Calling";
};
IV_FunctionC : SYSTEM interfaceview::IV::FunctionC::FunctionC.others {
Taste::FunctionName => "FunctionC";
};
IV_FunctionSimulink : SYSTEM interfaceview::IV::FunctionSimulink::FunctionSimulink.others {
Taste::FunctionName => "FunctionSimulink";
};
zynq_partition : PROCESS deploymentview::DV::Node2::zynq_partition.others {
Taste::coordinates => "66734 61206 155158 104288";
Deployment::Port_Number => 0;
};
zynq_rtems_posix : PROCESSOR ocarina_processors_arm::zynq.rtems_posix {
Taste::coordinates => "62168 52590 166795 110331";
};
PROPERTIES
Taste::APLC_Binding => (reference (zynq_partition)) APPLIES TO IV_Calling;
Taste::APLC_Binding => (reference (zynq_partition)) APPLIES TO IV_FunctionC;
Taste::APLC_Binding => (reference (zynq_partition)) APPLIES TO IV_FunctionSimulink;
Actual_Processor_Binding => (reference (zynq_rtems_posix)) APPLIES TO zynq_partition;
END Node2.others;
SYSTEM deploymentview
END deploymentview;
SYSTEM IMPLEMENTATION deploymentview.others
SUBCOMPONENTS
Node2 : SYSTEM Node2.others {
Taste::coordinates => "56461 40281 172838 116149";
};
interfaceview : SYSTEM interfaceview::IV::interfaceview.others;
END deploymentview.others;
PROPERTIES
Taste::coordinates => "0 0 297000 210000";
Taste::version => "2.3";
Taste::interfaceView => "InterfaceView.aadl";
Taste::HWLibraries => ("/home/taste/tool-inst/share/ocarina/AADLv2/ocarina_components.aadl");
END deploymentview::DV;
---------------------------------------------------
-- AADL2.2
-- TASTE type interfaceview
--
-- generated code: do not edit
---------------------------------------------------
PACKAGE interfaceview::IV::Calling
PUBLIC
WITH interfaceview::IV::FunctionC;
WITH interfaceview::IV::FunctionSimulink;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_pulse
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_pulse;
SUBPROGRAM IMPLEMENTATION PI_pulse.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_pulse.others;
SUBPROGRAM PI_changeMode
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_changeMode;
SUBPROGRAM IMPLEMENTATION PI_changeMode.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 0 ms;
END PI_changeMode.others;
SUBPROGRAM RI_stress
FEATURES
inp : IN PARAMETER DataView::TypeNested {
Taste::encoding => NATIVE;
};
outp : OUT PARAMETER DataView::TypeNested {
Taste::encoding => NATIVE;
};
END RI_stress;
SUBPROGRAM IMPLEMENTATION RI_stress.others
END RI_stress.others;
SUBPROGRAM RI_stressMore
FEATURES
inp : IN PARAMETER DataView::TypeNested {
Taste::encoding => NATIVE;
};
outp : OUT PARAMETER DataView::TypeNested {
Taste::encoding => NATIVE;
};
END RI_stressMore;
SUBPROGRAM IMPLEMENTATION RI_stressMore.others
END RI_stressMore.others;
SYSTEM Calling
FEATURES
PI_pulse : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Calling::PI_pulse.others {
Taste::coordinates => "134118 72610";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 1000 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "pulse";
};
PI_changeMode : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::Calling::PI_changeMode.others {
Taste::coordinates => "111658 56233";
Taste::RCMoperationKind => cyclic;
Taste::RCMperiod => 3000 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "changeMode";
};
RI_stress : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::FunctionC::PI_stress.others {
Taste::coordinates => "134118 77341";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "stress";
Taste::labelInheritance => "true";
};
RI_stressMore : REQUIRES SUBPROGRAM ACCESS interfaceview::IV::FunctionSimulink::PI_stressMore.others {
Taste::coordinates => "134118 84919";
Taste::RCMoperationKind => any;
Taste::InterfaceName => "stressMore";
Taste::labelInheritance => "true";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => any;
END Calling;
SYSTEM IMPLEMENTATION Calling.others
END Calling.others;
END interfaceview::IV::Calling;
PACKAGE interfaceview::IV::FunctionC
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_stress
FEATURES
inp : IN PARAMETER DataView::TypeNested {
Taste::encoding => NATIVE;
};
outp : OUT PARAMETER DataView::TypeNested {
Taste::encoding => NATIVE;
};
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_stress;
SUBPROGRAM IMPLEMENTATION PI_stress.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 1000 ms;
END PI_stress.others;
SYSTEM FunctionC
FEATURES
PI_stress : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::FunctionC::PI_stress.others {
Taste::coordinates => "164555 64396";
Taste::RCMoperationKind => unprotected;
Taste::RCMperiod => 0 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "stress";
};
PROPERTIES
Source_Language => (C);
Taste::Active_Interfaces => any;
END FunctionC;
SYSTEM IMPLEMENTATION FunctionC.others
END FunctionC.others;
END interfaceview::IV::FunctionC;
PACKAGE interfaceview::IV::FunctionSimulink
PUBLIC
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SUBPROGRAM PI_stressMore
FEATURES
inp : IN PARAMETER DataView::TypeNested {
Taste::encoding => NATIVE;
};
outp : OUT PARAMETER DataView::TypeNested {
Taste::encoding => NATIVE;
};
PROPERTIES
Taste::Associated_Queue_Size => 1;
END PI_stressMore;
SUBPROGRAM IMPLEMENTATION PI_stressMore.others
PROPERTIES
Compute_Execution_Time => 0 ms .. 1000 ms;
END PI_stressMore.others;
SYSTEM FunctionSimulink
FEATURES
PI_stressMore : PROVIDES SUBPROGRAM ACCESS interfaceview::IV::FunctionSimulink::PI_stressMore.others {
Taste::coordinates => "165075 87800";
Taste::RCMoperationKind => unprotected;
Taste::RCMperiod => 0 ms;
Taste::Deadline => 0 ms;
Taste::InterfaceName => "stressMore";
};
PROPERTIES
Source_Language => (Simulink);
Taste::Active_Interfaces => any;
END FunctionSimulink;
SYSTEM IMPLEMENTATION FunctionSimulink.others
END FunctionSimulink.others;
END interfaceview::IV::FunctionSimulink;
PACKAGE interfaceview::IV
PUBLIC
WITH interfaceview::IV::Calling;
WITH interfaceview::IV::FunctionC;
WITH interfaceview::IV::FunctionSimulink;
WITH Taste;
WITH DataView;
WITH TASTE_IV_Properties;
SYSTEM interfaceview
PROPERTIES
Taste::dataView => ("DataView");
Taste::dataViewPath => ("DataView.aadl");
END interfaceview;
SYSTEM IMPLEMENTATION interfaceview.others
SUBCOMPONENTS
Calling : SYSTEM interfaceview::IV::Calling::Calling.others {
Taste::coordinates => "84026 56233 134118 94530";
};
FunctionC : SYSTEM interfaceview::IV::FunctionC::FunctionC.others {
Taste::coordinates => "164555 61036 240301 73476";
TASTE_IV_Properties::FPGA_Configurations => "ModeC";
};
FunctionSimulink : SYSTEM interfaceview::IV::FunctionSimulink::FunctionSimulink.others {
Taste::coordinates => "165075 80857 240309 94072";
TASTE_IV_Properties::FPGA_Configurations => "ModeD";
};
CONNECTIONS
FunctionC_PI_stress_Calling_RI_stress : SUBPROGRAM ACCESS FunctionC.PI_stress -> Calling.RI_stress {
Taste::coordinates => "134118 77341 161936 77341 161936 64396 164555 64396";
};
FunctionSimulink_PI_stressMore_Calling_RI_stressMore : SUBPROGRAM ACCESS FunctionSimulink.PI_stressMore -> Calling.RI_stressMore {
Taste::coordinates => "134118 84919 149596 84919 149596 87800 165075 87800";
};
END interfaceview.others;
PROPERTIES
Taste::dataView => ("DataView");
Taste::dataViewPath => ("DataView.aadl");
Taste::coordinates => "0 0 297000 210000";
Taste::version => "2.2";
END interfaceview::IV;
KAZOO?=kazoo
# Here you can specify folders containing external code you want to
# compile and link for a specific partition.
# Use upper case for the partition name:
# export <PARTITION_NAME>_EXTERNAL_SOURCE_PATH=/absolute/path/1:/....
all: c
c: work/glue_built
$(MAKE) -C work
skeletons:
$(MAKE) work/skeletons_built
cp -r calling/* work/calling/C/src
cp -r functionc/* work/functionc/C/src
cp -r functionsimulink/* work/functionsimulink/SIMULINK/src
work/skeletons_built: InterfaceView.aadl DataView.aadl
$(KAZOO) --gw -o work
$(MAKE) -C work dataview
touch $@
work/glue_built: InterfaceView.aadl DeploymentView.aadl DataView.aadl
$(KAZOO) -p --glue --gw -o work
touch $@
clean:
rm -rf work/build
rm -f work/glue_built work/skeletons_built
find work -type d -name "wrappers" -exec rm -rf {} +
find work -type d -name "*_GUI" -exec rm -rf {} +
.PHONY: clean skeletons c
/* User code: This file will not be overwritten by TASTE. */
#include "calling.h"
#include <string.h>
#include <stdio.h>
char p_szGlobalState[10] = "modeX";
#define FPGA_READY "ready"
#define FPGA_RECONFIGURING "reconfiguring"
#define FPGA_ERROR "error"
#define FPGA_DISABLED "disabled"
// For each HWSW Function Block a global variable must be created with name "globalFpgaStatus_<Function Block's name>".
// This variable will host at any time the current HW status associated with the respective Function Block.
// This status shall be updated by the HW reconfiguration manager commanding of the FPGA and FPGA status check,
// and can be one of: FPGA_READY, FPGA_RECONFIGURING, FPGA_ERROR, FPGA_DISABLED.
// Status is kept per Function Block and not for the full FPGA, to accommodate for future work on partial reconfiguration of the HW accelerator.
char globalFpgaStatus_functionc[20] = FPGA_READY;
char globalFpgaStatus_functionsimulink[20] = FPGA_READY;
//uncomment the following define to print debug level info
//#define DEBUG_RECONF
void calling_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
printf("\n[calling_startup] Starting up ...\n");
}
void printTypeNested(asn1SccTypeNested *data)
{
printf("[printTypeNested] to be implemented\n");
}
void calling_PI_changeMode()
{
char new_config[10] = "";
if (strcmp(p_szGlobalState, "modeX") == 0) {
strcpy(new_config, "modeC");
}else{
if (strcmp(p_szGlobalState, "modeC") == 0) {
strcpy(new_config, "modeD");
}else{
strcpy(new_config, "modeX");
}
}
printf("[calling_PI_changeMode] Initiating mode change %s => %s ... \n", p_szGlobalState, new_config);
strcpy(p_szGlobalState, new_config);
printf("[calling_PI_changeMode] Current mode is %s\n", p_szGlobalState);
}
void calling_PI_pulse()
{
//printf("\n[calling_PI_pulse] Current mode is %s\n", p_szGlobalState);
//TODO init input data?
static asn1SccTypeNested inp, outp;
if (strcmp(p_szGlobalState, "modeC") == 0) {
printf("[calling_PI_pulse] Calling 'calling_RI_stress'\n");
calling_RI_stress(&inp, &outp);
}else{
printf("[calling_PI_pulse] Calling 'calling_RI_stressMore'\n");
calling_RI_stressMore(&inp, &outp);
}
printf("[calling_PI_pulse] Sent:\n");
printTypeNested(&inp);
printf("[calling_PI_pulse] Received:\n");
printTypeNested(&outp);
//TODO change input data?
}
/* This file was generated automatically: DO NOT MODIFY IT ! */
/* Declaration of the functions that have to be provided by the user */
#ifndef __USER_CODE_H_calling__
#define __USER_CODE_H_calling__
#include "C_ASN1_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void calling_startup();
void calling_PI_pulse();
void calling_PI_changeMode();
extern void calling_RI_init();
extern void calling_RI_run(const asn1SccMyInteger *,
const asn1SccMyInteger *);
extern void calling_RI_status(asn1SccMyInteger *);
extern void calling_RI_stress(const asn1SccTypeNested *,
asn1SccTypeNested *);
extern void calling_RI_stressMore(const asn1SccTypeNested *,
asn1SccTypeNested *);
#ifdef __cplusplus
}
#endif
#endif
/* User code: This file will not be overwritten by TASTE. */
#include "functionc.h"
void functionc_startup()
{
/* Write your initialization code here,
but do not make any call to a required interface. */
}
void functionc_PI_stress(const asn1SccTypeNested *IN_inp,
asn1SccTypeNested *OUT_outp)
{
/* Write your code here! */
*OUT_outp = *IN_inp;
}
/* This file was generated automatically: DO NOT MODIFY IT ! */
/* Declaration of the functions that have to be provided by the user */
#ifndef __USER_CODE_H_functionc__
#define __USER_CODE_H_functionc__
#include "C_ASN1_Types.h"
#ifdef __cplusplus
extern "C" {
#endif
void functionc_startup();
void functionc_PI_stress(const asn1SccTypeNested *,
asn1SccTypeNested *);
#ifdef __cplusplus
}
#endif
#endif
/*
* File: ert_main.c
*
* Code generated for Simulink model 'stressMore'.
*
* Model version : 1.2
* Simulink Coder version : 8.12 (R2017a) 16-Feb-2017
* C/C++ source code generated on : Tue Sep 24 10:12:32 2019
*
* Target selection: ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include <stddef.h>
#include <stdio.h> /* This ert_main.c example uses printf/fflush */
#include "stressMore.h" /* Model's header file */
#include "rtwtypes.h"
/*
* Associating rt_OneStep with a real-time clock or interrupt service routine
* is what makes the generated code "real-time". The function rt_OneStep is
* always associated with the base rate of the model. Subrates are managed
* by the base rate from inside the generated code. Enabling/disabling
* interrupts and floating point context switches are target specific. This
* example code indicates where these should take place relative to executing
* the generated code step function. Overrun behavior should be tailored to
* your application needs. This example simply sets an error status in the
* real-time model and returns from rt_OneStep.
*/
void rt_OneStep(void);
void rt_OneStep(void)
{
static boolean_T OverrunFlag = false;
/* Disable interrupts here */
/* Check for overrun */
if (OverrunFlag) {
rtmSetErrorStatus(stressMore_M, "Overrun");
return;
}
OverrunFlag = true;
/* Save FPU context here (if necessary) */
/* Re-enable timer or interrupt here */
/* Set model inputs here */
/* Step the model */
stressMore_step();
/* Get model outputs here */
/* Indicate task complete */
OverrunFlag = false;
/* Disable interrupts here */
/* Restore FPU context here (if necessary) */
/* Enable interrupts here */
}
/*
* The example "main" function illustrates what is required by your
* application code to initialize, execute, and terminate the generated code.
* Attaching rt_OneStep to a real-time clock is target specific. This example
* illustrates how you do this relative to initializing the model.
*/
int_T main(int_T argc, const char *argv[])
{
/* Unused arguments */
(void)(argc);
(void)(argv);
/* Initialize model */
stressMore_initialize();
/* Attach rt_OneStep to a timer or interrupt service routine with
* period 0.2 seconds (the model's base sample time) here. The
* call syntax for rt_OneStep is
*
* rt_OneStep();
*/
printf("Warning: The simulation will run forever. "
"Generated ERT main won't simulate model step behavior. "
"To change this behavior select the 'MAT-file logging' option.\n");
fflush((NULL));
while (rtmGetErrorStatus(stressMore_M) == (NULL)) {
/* Perform other application tasks here */
}
/* Disable rt_OneStep() here */
/* Terminate model */
stressMore_terminate();
return 0;
}
/*
* File trailer for generated code.
*
* [EOF]
*/
run Simulink_DataView_asn;
inports_positions = zeros(1, 4);
bussel_positions = zeros(1, 4);