Esterel v5 File: abro.strl | top |
module ABRO:
type data;
input A : string;
input B : data;
input R;
output O : data;
function resolve(string, data): data;
loop
[ await A || await B ];
emit O(resolve(?a, ?B))
each R
end module
ESI Scenario File: abro.esi | top |
A ("1");
B ("premier tirage");
A("2");
!note ?A = "1" and present B;
B ("second tirage");
R;
%A ("3");
%B ("troisieme tirage");
C Generated File: ABRO_abro_tb.c | top |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* ASSERTIONS */
#define AssertionFlag 1
/* USER DEFINED TYPE DATA */
#include "abro.h"
extern int _check_data(char *);
extern char *_data_to_text(data);
extern void _text_to_data(data *, char *);
extern int _eq_data(data,data);
extern int _ne_data(data,data);
static data __text_to_data( char *st) {
data back;
_text_to_data(back, st);
return back;
}
extern int _less_data(data,data);
static int _great_data(data av1,data av2) {
return _less_data(av2, av1);
}
static int _lesseq_data(data av1,data av2) {
return _less_data(av1, av2) || _eq_data(av1, av2);
}
static int _greateq_data(data av1,data av2) {
return _lesseq_data(av2, av1);
}
static char *_strcat(char *av1, char *av2) {
char *back;
int size_av1 = !av1 ? 0 : strlen(av1);
int size_av2 = !av2 ? 0 : strlen(av2);
if (!size_av1) return av2;
if (!size_av2) return av1;
back = (char *)malloc(size_av1 + size_av2 + 1);
if (!back) return (char *)0;
strcpy(back, av1);
strcpy(back + size_av1, av2);
back[size_av1 + size_av2] = '\0';
return back;
}
static int _strcmp(char *av1, char *av2) {
if (!av1 || !av2) return 0;
return strcmp(av1, av2);
}
#define __strcat(Ls, Lv, Rs, Rv) _strcat((Lv),(Rv))
#define __streq(Ls, Lv, Rs, Rv) !_strcmp((Lv),(Rv))
#define __strneq(Ls, Lv, Rs, Rv) _strcmp((Lv),(Rv))
#define __strless(Ls, Lv, Rs, Rv) _strcmp((Lv),(Rv)) < 0
#define __strlesseq(Ls, Lv, Rs, Rv) _strcmp((Lv),(Rv)) <= 0
#define __strgreat(Ls, Lv, Rs, Rv) _strcmp((Lv),(Rv)) > 0
#define __strgreateq(Ls, Lv, Rs, Rv) _strcmp((Lv),(Rv)) >= 0
#define __eq_data(Ls, Lv, Rs, Rv) _eq_data((Lv), (Rv))
#define __neq_data(Ls, Lv, Rs, Rv) _ne_data((Lv), (Rv))
#define __less_data(Ls, Lv, Rs, Rv) _less_data((Lv), (Rv))
#define __lesseq_data(Ls, Lv, Rs, Rv) _lesseq_data((Lv),(Rv))
#define __great_data(Ls, Lv, Rs, Rv) _great_data((Lv), (Rv))
#define __greateq_data(Ls, Lv, Rs, Rv) _greateq_data((Lv),(Rv))
/* ABRO ACTIONS */
extern int ABRO_run();
extern int ABRO_reset();
/* INPUTS */
static int ABRO_A_wrapper_status = 0;
static char * ABRO_A_wrapper_value;
extern void ABRO_I_A(char *);
static int ABRO_B_wrapper_status = 0;
static data ABRO_B_wrapper_value;
extern void ABRO_I_B(data);
static int ABRO_R_wrapper_status = 0;
extern void ABRO_I_R(void);
/* OUTPUTS */
static int ABRO_O_wrapper_status = 0;
static data ABRO_O_wrapper_value;
void ABRO_O_O(data _value) {
ABRO_O_wrapper_status = 1;
ABRO_O_wrapper_value = _value;
}
/* SENSORS */
/* SIGNAL INSTRUMENTATION */
#ifdef STATE_DUMP
extern void ABRO_state_dump_init();
extern void ABRO_state_dump_end();
#endif /* STATE_DUMP */
#ifdef SIGNAL_RECORD
extern void ABRO_signal_record_init(char *);
extern void ABRO_signal_record_end();
extern void ABRO_signal_record_comment(char *);
#endif /* SIGNAL_RECORD */
/* MAIN */
int main(int ac, char *av[]) {
#ifdef STATE_DUMP
ABRO_state_dump_init("dump_abro.blif");
#endif /* STATE_DUMP */
#ifdef SIGNAL_RECORD
ABRO_signal_record_init("record_abro.eso");
#endif /* SIGNAL_RECORD */
ABRO_reset();
ABRO_A_wrapper_status = 1;
ABRO_I_A("1");
ABRO_A_wrapper_value = "1";
ABRO_B_wrapper_status = 0;
ABRO_R_wrapper_status = 0;
ABRO_O_wrapper_status = 0;
#ifdef SIGNAL_RECORD
ABRO_signal_record_comment("Cycle 1");
#endif /* SIGNAL_RECORD */
/* Sync on CLK rising edge */
ABRO_run();
/* Outputs checking */
/*********************************/
/* CLK cycle number: 2 */
/*********************************/
/* Inputs initialization */
ABRO_B_wrapper_status = 1;
if (!_check_data("premier tirage")) {
#ifdef STATE_DUMP
ABRO_state_dump_end();
#endif /* STATE_DUMP */
#ifdef SIGNAL_RECORD
ABRO_signal_record_comment("Run-time checking type error, file abro.esi, line 2: valued signal B of type \"data\" set on \"premier tirage\".");
ABRO_signal_record_end();
#endif /* SIGNAL_RECORD */
return 1;
}
ABRO_I_B(__text_to_data("premier tirage"));
ABRO_B_wrapper_value = __text_to_data("premier tirage");
ABRO_A_wrapper_status = 0;
ABRO_R_wrapper_status = 0;
ABRO_O_wrapper_status = 0;
#ifdef SIGNAL_RECORD
ABRO_signal_record_comment("Cycle 2");
#endif /* SIGNAL_RECORD */
/* Sync on CLK rising edge */
ABRO_run();
/* Outputs checking */
/*********************************/
/* CLK cycle number: 3 */
/*********************************/
/* Inputs initialization */
ABRO_A_wrapper_status = 1;
ABRO_I_A("2");
ABRO_A_wrapper_value = "2";
ABRO_B_wrapper_status = 0;
ABRO_R_wrapper_status = 0;
ABRO_O_wrapper_status = 0;
#ifdef SIGNAL_RECORD
ABRO_signal_record_comment("Cycle 3");
#endif /* SIGNAL_RECORD */
/* Sync on CLK rising edge */
ABRO_run();
/* Outputs checking */
/*********************************/
/* CLK cycle number: 4 */
/*********************************/
/* Inputs initialization */
ABRO_B_wrapper_status = 1;
if (!_check_data("second tirage")) {
#ifdef STATE_DUMP
ABRO_state_dump_end();
#endif /* STATE_DUMP */
#ifdef SIGNAL_RECORD
ABRO_signal_record_comment("Run-time checking type error, file abro.esi, line 7: valued signal B of type \"data\" set on \"second tirage\".");
ABRO_signal_record_end();
#endif /* SIGNAL_RECORD */
return 1;
}
ABRO_I_B(__text_to_data("second tirage"));
ABRO_B_wrapper_value = __text_to_data("second tirage");
ABRO_A_wrapper_status = 0;
ABRO_R_wrapper_status = 0;
ABRO_O_wrapper_status = 0;
#ifdef SIGNAL_RECORD
ABRO_signal_record_comment("Cycle 4");
#endif /* SIGNAL_RECORD */
/* Sync on CLK rising edge */
ABRO_run();
/* Outputs checking */
/*********************************/
/* CLK cycle number: 5 */
/*********************************/
/* Inputs initialization */
if (AssertionFlag) {
if (!(__streq(ABROA_wrapper_status, ABRO_A_wrapper_value, 2, "1") && ABRO_B_wrapper_status)) {
#ifdef SIGNAL_RECORD
ABRO_signal_record_comment("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
ABRO_signal_record_comment("NOTE: Break point reached");
ABRO_signal_record_comment(" file 'abro.esi'");
ABRO_signal_record_comment(" line '6'");
ABRO_signal_record_comment("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
#endif /* SIGNAL_RECORD */
}
}
ABRO_I_R();
ABRO_R_wrapper_status = 1;
ABRO_A_wrapper_status = 0;
ABRO_B_wrapper_status = 0;
ABRO_O_wrapper_status = 0;
#ifdef SIGNAL_RECORD
ABRO_signal_record_comment("Cycle 5");
#endif /* SIGNAL_RECORD */
/* Sync on CLK rising edge */
ABRO_run();
/* Outputs checking */
/*********************************/
/* CLK cycle number: 6 */
/*********************************/
/* Inputs initialization */
/* A (\"3\"); */
#ifdef SIGNAL_RECORD
ABRO_signal_record_comment("A (\"3\");");
#endif /* SIGNAL_RECORD */
/* B (\"troisieme tirage\"); */
#ifdef SIGNAL_RECORD
ABRO_signal_record_comment("B (\"troisieme tirage\");");
#endif /* SIGNAL_RECORD */
#ifdef STATE_DUMP
ABRO_state_dump_end();
#endif /* STATE_DUMP */
#ifdef SIGNAL_RECORD
ABRO_signal_record_end();
#endif /* SIGNAL_RECORD */
return 0;
}
/* END */
C++ Generated File: ABRO_abro_tb.cpp | top |
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* ASSERTIONS */
#define AssertionFlag 1
#include "abro_class.h"
/* USER DEFINED TYPE DATA */
#include "abro_data.h"
extern "C" int _check_data(char *);
extern "C" char *_data_to_text(data);
extern "C" void _text_to_data(data *, char *);
extern "C" int _eq_data(data,data);
extern "C" int _ne_data(data,data);
static data __text_to_data( char *st) {
data back;
_text_to_data(back, st);
return back;
}
extern "C" int _less_data(data,data);
static int _great_data(data av1,data av2) {
return _less_data(av2, av1);
}
static int _lesseq_data(data av1,data av2) {
return _less_data(av1, av2) || _eq_data(av1, av2);
}
static int _greateq_data(data av1,data av2) {
return _lesseq_data(av2, av1);
}
static char *_strcat(char *av1, char *av2) {
char *back;
int size_av1 = !av1 ? 0 : strlen(av1);
int size_av2 = !av2 ? 0 : strlen(av2);
if (!size_av1) return av2;
if (!size_av2) return av1;
back = (char *)malloc(size_av1 + size_av2 + 1);
if (!back) return (char *)0;
strcpy(back, av1);
strcpy(back + size_av1, av2);
back[size_av1 + size_av2] = '\0';
return back;
}
static int _strcmp(char *av1, char *av2) {
if (!av1 || !av2) return 0;
return strcmp(av1, av2);
}
#define __strcat(Ls, Lv, Rs, Rv) _strcat((Lv),(Rv))
#define __streq(Ls, Lv, Rs, Rv) !_strcmp((Lv),(Rv))
#define __strneq(Ls, Lv, Rs, Rv) _strcmp((Lv),(Rv))
#define __strless(Ls, Lv, Rs, Rv) _strcmp((Lv),(Rv)) < 0
#define __strlesseq(Ls, Lv, Rs, Rv) _strcmp((Lv),(Rv)) <= 0
#define __strgreat(Ls, Lv, Rs, Rv) _strcmp((Lv),(Rv)) > 0
#define __strgreateq(Ls, Lv, Rs, Rv) _strcmp((Lv),(Rv)) >= 0
#define __eq_data(Ls, Lv, Rs, Rv) _eq_data((Lv), (Rv))
#define __neq_data(Ls, Lv, Rs, Rv) _ne_data((Lv), (Rv))
#define __less_data(Ls, Lv, Rs, Rv) _less_data((Lv), (Rv))
#define __lesseq_data(Ls, Lv, Rs, Rv) _lesseq_data((Lv),(Rv))
#define __great_data(Ls, Lv, Rs, Rv) _great_data((Lv), (Rv))
#define __greateq_data(Ls, Lv, Rs, Rv) _greateq_data((Lv),(Rv))
/* INPUTS */
static int ABRO_A_wrapper_status = 0;
static char * ABRO_A_wrapper_value;
static int ABRO_B_wrapper_status = 0;
static data ABRO_B_wrapper_value;
static int ABRO_R_wrapper_status = 0;
/* OUTPUTS */
static int ABRO_O_wrapper_status = 0;
static data ABRO_O_wrapper_value;
void ABRO::O_O(data _value) {
ABRO_O_wrapper_status = 1;
ABRO_O_wrapper_value = _value;
}
/* SENSORS */
/* MAIN */
int main(int ac, char *av[]) {
ABRO instance;
#ifdef STATE_DUMP
instance._state_dump_init("dump_abro.blif");
#endif /* STATE_DUMP */
#ifdef SIGNAL_RECORD
instance._signal_record_init("record_abro.eso");
#endif /* SIGNAL_RECORD */
instance.reset();
ABRO_A_wrapper_status = 1;
instance.I_A("1");
ABRO_A_wrapper_value = "1";
ABRO_B_wrapper_status = 0;
ABRO_R_wrapper_status = 0;
ABRO_O_wrapper_status = 0;
#ifdef SIGNAL_RECORD
instance._signal_record_comment("Cycle 1");
#endif /* SIGNAL_RECORD */
/* Sync on CLK rising edge */
instance.run();
/* Outputs checking */
/*********************************/
/* CLK cycle number: 2 */
/*********************************/
/* Inputs initialization */
ABRO_B_wrapper_status = 1;
if (!_check_data("premier tirage")) {
#ifdef STATE_DUMP
instance._state_dump_end();
#endif /* STATE_DUMP */
#ifdef SIGNAL_RECORD
instance._signal_record_comment("Run-time checking type error, file abro.esi, line 2: valued signal B of type \"data\" set on \"premier tirage\".");
instance._signal_record_end();
#endif /* SIGNAL_RECORD */
return 1;
}
instance.I_B(__text_to_data("premier tirage"));
ABRO_B_wrapper_value = __text_to_data("premier tirage");
ABRO_A_wrapper_status = 0;
ABRO_R_wrapper_status = 0;
ABRO_O_wrapper_status = 0;
#ifdef SIGNAL_RECORD
instance._signal_record_comment("Cycle 2");
#endif /* SIGNAL_RECORD */
/* Sync on CLK rising edge */
instance.run();
/* Outputs checking */
/*********************************/
/* CLK cycle number: 3 */
/*********************************/
/* Inputs initialization */
ABRO_A_wrapper_status = 1;
instance.I_A("2");
ABRO_A_wrapper_value = "2";
ABRO_B_wrapper_status = 0;
ABRO_R_wrapper_status = 0;
ABRO_O_wrapper_status = 0;
#ifdef SIGNAL_RECORD
instance._signal_record_comment("Cycle 3");
#endif /* SIGNAL_RECORD */
/* Sync on CLK rising edge */
instance.run();
/* Outputs checking */
/*********************************/
/* CLK cycle number: 4 */
/*********************************/
/* Inputs initialization */
ABRO_B_wrapper_status = 1;
if (!_check_data("second tirage")) {
#ifdef STATE_DUMP
instance._state_dump_end();
#endif /* STATE_DUMP */
#ifdef SIGNAL_RECORD
instance._signal_record_comment("Run-time checking type error, file abro.esi, line 7: valued signal B of type \"data\" set on \"second tirage\".");
instance._signal_record_end();
#endif /* SIGNAL_RECORD */
return 1;
}
instance.I_B(__text_to_data("second tirage"));
ABRO_B_wrapper_value = __text_to_data("second tirage");
ABRO_A_wrapper_status = 0;
ABRO_R_wrapper_status = 0;
ABRO_O_wrapper_status = 0;
#ifdef SIGNAL_RECORD
instance._signal_record_comment("Cycle 4");
#endif /* SIGNAL_RECORD */
/* Sync on CLK rising edge */
instance.run();
/* Outputs checking */
/*********************************/
/* CLK cycle number: 5 */
/*********************************/
/* Inputs initialization */
if (AssertionFlag) {
if (!(__streq(ABRO_A_wrapper_status, ABRO_A_wrapper_value, 2, "1") && ABRO_B_wrapper_status)) {
#ifdef SIGNAL_RECORD
instance._signal_record_comment("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%");
instance._signal_record_comment("NOTE: Break point reached");
instance._signal_record_comment(" file 'abro.esi'");
instance._signal_record_comment(" line '6'");
instance._signal_record_comment("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
#endif /* SIGNAL_RECORD */
}
}
instance.I_R();
ABRO_R_wrapper_status = 1;
ABRO_A_wrapper_status = 0;
ABRO_B_wrapper_status = 0;
ABRO_O_wrapper_status = 0;
#ifdef SIGNAL_RECORD
instance._signal_record_comment("Cycle 5");
#endif /* SIGNAL_RECORD */
/* Sync on CLK rising edge */
instance.run();
/* Outputs checking */
/*********************************/
/* CLK cycle number: 6 */
/*********************************/
/* Inputs initialization */
/* A (\"3\"); */
#ifdef SIGNAL_RECORD
instance._signal_record_comment("A (\"3\");");
#endif /* SIGNAL_RECORD */
/* B (\"troisieme tirage\"); */
#ifdef SIGNAL_RECORD
instance._signal_record_comment("B (\"troisieme tirage\");");
#endif /* SIGNAL_RECORD */
#ifdef STATE_DUMP
instance._state_dump_end();
#endif /* STATE_DUMP */
#ifdef SIGNAL_RECORD
instance._signal_record_end();
#endif /* SIGNAL_RECORD */
return 0;
}
/* END */
Verilog Generated File: ABRO_abro_tb.v | top |
`timescale 1ns/100ps
`define AssertionFlag 1'b 1
`define esterelSTRING [10*8:1]
`define esterelINTEGER [31:0]
`define esterelBOOLEAN
`define esterelLOGIC
`include "ABRO_data_type_pkg.v"
module ABRO_abro_tb;
reg stop;
reg `esterelSTRING Assertion;
reg [31:0] temporaryOutputFile;
parameter Delay = 10;
`include "ABRO_data_pkg.v"
`include "ABRO_data_sim_pkg.v"
reg `esterelLOGIC sig_clk;
reg `esterelLOGIC sig_rst;
reg `esterelLOGIC sig_A;
reg `esterelSTRING sig_A_data;
reg `esterelLOGIC sig_B;
reg `data sig_B_data;
reg `esterelLOGIC sig_R;
wire `esterelLOGIC sig_O;
wire `data sig_O_data;
task WriteLogOutputs;
input `esterelLOGIC sig_O;
input `data sig_O_data;
begin
if (sig_O) begin
$fdisplay( temporaryOutputFile, "%% Output: = \"%s\"", data_to_text(sig_O_data));
end
end
endtask
initial sig_clk = 1'b 0;
always #(Delay / 2) begin
if (stop) begin
sig_clk <= 1'b 0;
disable SCENARIO;
end else begin
sig_clk <= ~sig_clk;
end
end
ABRO COMP (
.clk(sig_clk),
.rst(sig_rst),
.A(sig_A),
.A_data(sig_A_data),
.B(sig_B),
.B_data(sig_B_data),
.R(sig_R),
.O(sig_O),
.O_data(sig_O_data)
);
initial
begin : SCENARIO
temporaryOutputFile = $fopen("record_abro.eso");
stop = 1'b 0;
Assertion = "NOTE";
// -----
$fdisplay(temporaryOutputFile, "%% -----");
// File record_abro.eso generated from Esterel module ABRO.
$fdisplay(temporaryOutputFile, "%% File record_abro.eso generated from Esterel module ABRO.");
// -----
$fdisplay(temporaryOutputFile, "%% -----");
// RST //
sig_rst <= 1'b 1;
@(posedge sig_clk);
$fdisplay( temporaryOutputFile, "! reset;");
sig_A <= 1'b 1;
sig_A_data <= "1";
$fdisplay( temporaryOutputFile, "A = \"1\"");
sig_rst <= 1'b 0;
sig_B <= 1'b 0;
sig_R <= 1'b 0;
// Sync on CLK rising edge //
@(posedge sig_clk);
$fdisplay( temporaryOutputFile, "%% Cycle 1");
// Log outputs to file //
WriteLogOutputs( sig_O, sig_O_data);
$fdisplay( temporaryOutputFile, ";");
// Outputs checking //
///////////////////////////////////
// CLK cycle number: 2 //
///////////////////////////////////
// Inputs initialization //
sig_B <= 1'b 1;
if (!check_data("premier tirage")) begin
stop <= 1'b 1;
$fdisplay( temporaryOutputFile, "bad user type value checked, in file abro.esi, line 1");
$fclose(temporaryOutputFile);
Assertion <= "FAILURE";
$stop;
end else begin
sig_B_data <= text_to_data("premier tirage");
end
$fdisplay( temporaryOutputFile, "B = \"premier tirage\"");
sig_rst <= 1'b 0;
sig_A <= 1'b 0;
sig_R <= 1'b 0;
// Sync on CLK rising edge //
@(posedge sig_clk);
$fdisplay( temporaryOutputFile, "%% Cycle 2");
// Log outputs to file //
WriteLogOutputs( sig_O, sig_O_data);
$fdisplay( temporaryOutputFile, ";");
// Outputs checking //
///////////////////////////////////
// CLK cycle number: 3 //
///////////////////////////////////
// Inputs initialization //
sig_A <= 1'b 1;
sig_A_data <= "2";
$fdisplay( temporaryOutputFile, "A = \"2\"");
sig_rst <= 1'b 0;
sig_B <= 1'b 0;
sig_R <= 1'b 0;
// Sync on CLK rising edge //
@(posedge sig_clk);
$fdisplay( temporaryOutputFile, "%% Cycle 3");
// Log outputs to file //
WriteLogOutputs( sig_O, sig_O_data);
$fdisplay( temporaryOutputFile, ";");
// Outputs checking //
///////////////////////////////////
// CLK cycle number: 4 //
///////////////////////////////////
// Inputs initialization //
sig_B <= 1'b 1;
if (!check_data("second tirage")) begin
stop <= 1'b 1;
$fdisplay( temporaryOutputFile, "bad user type value checked, in file abro.esi, line 6");
$fclose(temporaryOutputFile);
Assertion <= "FAILURE";
$stop;
end else begin
sig_B_data <= text_to_data("second tirage");
end
$fdisplay( temporaryOutputFile, "B = \"second tirage\"");
sig_rst <= 1'b 0;
sig_A <= 1'b 0;
sig_R <= 1'b 0;
// Sync on CLK rising edge //
@(posedge sig_clk);
$fdisplay( temporaryOutputFile, "%% Cycle 4");
// Log outputs to file //
WriteLogOutputs( sig_O, sig_O_data);
$fdisplay( temporaryOutputFile, ";");
// Outputs checking //
///////////////////////////////////
// CLK cycle number: 5 //
///////////////////////////////////
// Inputs initialization //
if (`AssertionFlag) begin
if (!(((sig_A_data == "1") & sig_B == 1'b 1))) begin
$fdisplay(temporaryOutputFile, "%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n%% NOTE: Break point reached\n%% file 'abro.esi'\n%% line '6'\n%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n");
Assertion = "NOTE";
end
end
sig_R <= 1'b 1;
$fdisplay( temporaryOutputFile, "R");
sig_rst <= 1'b 0;
sig_A <= 1'b 0;
sig_B <= 1'b 0;
// Sync on CLK rising edge //
@(posedge sig_clk);
$fdisplay( temporaryOutputFile, "%% Cycle 5");
// Log outputs to file //
WriteLogOutputs( sig_O, sig_O_data);
$fdisplay( temporaryOutputFile, ";");
// Outputs checking //
///////////////////////////////////
// CLK cycle number: 6 //
///////////////////////////////////
// Inputs initialization //
// A (\"3\");
$fdisplay(temporaryOutputFile, "%% A (\"3\");");
// B (\"troisieme tirage\");
$fdisplay(temporaryOutputFile, "%% B (\"troisieme tirage\");");
stop = 1'b 1;
$fclose(temporaryOutputFile);
$stop;
end
endmodule
VHDL Generated File: ABRO_abro_tb.vhd | top |
library IEEE;
use IEEE.std_logic_1164.all;
use Work.ABRO_data_pkg.all;
use Work.ABRO_data_type_pkg.all;
package ABRO_data_sim_pkg is
function check_data( check_data_0: in string) return boolean;
function text_to_data( text_to_data_0: in string) return data ;
function data_to_text( signal data_to_text_0: in data) return string;
function "="( eq_data_0 : in data; eq_data_1 : in data) return boolean;
function "/="( neq_data_0 : in data; neq_data_1 : in data) return boolean;
function "<"( less_data_0 : in data; less_data_1 : in data) return boolean;
function "<="( lesseq_data_0 : in data; lesseq_data_1 : in data) return boolean;
end ABRO_data_sim_pkg;
use Work.ABRO_data_pkg.all;
use Work.ABRO_data_type_pkg.all;
use Work.ABRO_data_sim_pkg.all;
use std.textio.all;
library IEEE;
use IEEE.std_logic_1164.all;
entity ABRO_abro_tb is
constant Delay : Time := 10 ns ;
constant AssertionFlag : boolean := true;
end ABRO_abro_tb;
architecture ABRO_abro_MixedView of ABRO_abro_tb is
subtype esterelString is STRING ( 1 to 10);
component ABRO
port (
comp_clk : in STD_LOGIC;
comp_rst : in STD_LOGIC;
comp_A : in STD_LOGIC;
comp_A_data : in esterelString;
comp_B : in STD_LOGIC;
comp_B_data : in data;
comp_R : in STD_LOGIC;
comp_O : out STD_LOGIC;
comp_O_data : out data
);
end component;
for DUT:ABRO use entity Work.ABRO(ABRO_RTL)
port map(
clk => comp_clk,
rst => comp_rst,
A => comp_A,
A_data => comp_A_data,
B => comp_B,
B_data => comp_B_data,
R => comp_R,
O => comp_O,
O_data => comp_O_data
);
signal stop : boolean := FALSE;
signal sig_clk : STD_LOGIC := '0';
signal sig_rst : STD_LOGIC := '0';
signal sig_A : STD_LOGIC := '0';
signal sig_A_data : esterelString := (NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL);
signal sig_B : STD_LOGIC := '0';
signal sig_B_data : data := data_InitialValue;
signal sig_R : STD_LOGIC := '0';
signal sig_O : STD_LOGIC := '0';
signal sig_O_data : data := data_InitialValue;
file temporaryOutputFile : text OPEN WRITE_MODE is "record_abro.eso";
signal Assertion : severity_level;
procedure write_formatted_string( L : inout line; value : in String) is
variable index : positive := 1;
begin
loop
exit when (index = value'length + 1) or (value(index) = character'(NUL));
write(L, character'(value(index)));
index := index + 1;
end loop;
end write_formatted_string;
function "="( eq_data_0 : in data; eq_data_1 : in string) return boolean is
begin
return eq_data_0 = text_to_data(eq_data_1);
end;
function "="( eq_data_0 : in string; eq_data_1 : in data) return boolean is
begin
return eq_data_1 = text_to_data(eq_data_0);
end;
function "/="( neq_data_0 : in data; neq_data_1 : in string) return boolean is
begin
return neq_data_0 /= text_to_data(neq_data_1);
end;
function "/="( neq_data_0 : in string; neq_data_1 : in data) return boolean is
begin
return neq_data_1 = text_to_data(neq_data_0);
end;
function "<"( less_data_0 : in data; less_data_1 : in string) return boolean is
begin
return less_data_0 < text_to_data(less_data_1);
end;
function "<"( less_data_0 : in string; less_data_1 : in data) return boolean is
begin
return text_to_data(less_data_0) < less_data_1;
end;
function "<="( lesseq_data_0 : in data; lesseq_data_1 : in string) return boolean is
begin
return lesseq_data_0 <= text_to_data(lesseq_data_1);
end;
function "<="( lesseq_data_0 : in string; lesseq_data_1 : in data) return boolean is
begin
return text_to_data(lesseq_data_0) <= lesseq_data_1;
end;
function ">"( great_data_0 : in data; great_data_1 : in string) return boolean is
begin
return text_to_data(great_data_1) < great_data_0;
end;
function ">"( great_data_0 : in string; great_data_1 : in data) return boolean is
begin
return great_data_1 < text_to_data(great_data_0);
end;
function ">"( great_data_0 : in data; great_data_1 : in data) return boolean is
begin
return great_data_1 < great_data_0;
end;
function ">="( great_data_0 : in data; great_data_1 : in string) return boolean is
begin
return text_to_data(great_data_1) <= great_data_0;
end;
function ">="( great_data_0 : in string; great_data_1 : in data) return boolean is
begin
return great_data_1 <= text_to_data(great_data_0);
end;
function ">="( greateq_data_0 : in data; greateq_data_1 : in data) return boolean is
begin
return greateq_data_1 <= greateq_data_0;
end;
procedure WriteLogOutputs( file temporaryOutputFile: text; SIGNAL sig_O: in STD_LOGIC; SIGNAL sig_O_data: in data) is
variable temporaryLine: line;
begin
if sig_O = '1' then
write( temporaryLine, STRING'("% Output: O = """));
write_formatted_string( temporaryLine, esterelString'(data_to_text(sig_O_data)));
write( temporaryLine, STRING'(""""));
writeline( temporaryOutputFile, temporaryLine);
end if;
end WriteLogOutputs;
begin
DUT: ABRO port map (
comp_clk => sig_clk,
comp_rst => sig_rst,
comp_A => sig_A,
comp_A_data => sig_A_data,
comp_B => sig_B,
comp_B_data => sig_B_data,
comp_R => sig_R,
comp_O => sig_O,
comp_O_data => sig_O_data
);
CLOCK:
sig_clk <= not sig_clk after Delay / 2 when not stop else '0' after Delay / 2;
SCENARIO: process
variable temporaryLine: line;
begin
-- -----
write( temporaryLine, STRING'("% "));
write( temporaryLine, STRING'("-----"));
writeline( temporaryOutputFile, temporaryLine);
-- File record_abro.eso generated from Esterel module ABRO.
write( temporaryLine, STRING'("% "));
write( temporaryLine, STRING'("File record_abro.eso generated from Esterel module ABRO."));
writeline( temporaryOutputFile, temporaryLine);
-- -----
write( temporaryLine, STRING'("% "));
write( temporaryLine, STRING'("-----"));
writeline( temporaryOutputFile, temporaryLine);
-- RST --
sig_rst <= '1';
wait until sig_clk'event and sig_clk = '1';
write( temporaryLine, STRING'("! reset;"));
writeline( temporaryOutputFile, temporaryLine);
sig_A <= '1';
sig_A_data <= esterelString'("1" & (NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL));
write( temporaryLine, STRING'("A = ""1"""));
writeline( temporaryOutputFile, temporaryLine);
sig_rst <= '0';
sig_B <= '0';
sig_R <= '0';
-- Sync on CLK rising edge --
WAIT UNTIL sig_clk'EVENT AND sig_clk = '1';
write( temporaryLine, STRING'("% Cycle 1"));
writeline( temporaryOutputFile, temporaryLine);
-- Log outputs to file --
WriteLogOutputs( temporaryOutputFile, sig_O, sig_O_data);
write( temporaryLine, STRING'(";"));
writeline( temporaryOutputFile, temporaryLine);
-- Outputs checking --
-----------------------------------
-- CLK cycle number: 2 --
-----------------------------------
-- Inputs initialization --
sig_B <= '1';
if not check_data( STRING'("premier tirage")) then
stop <= true;
write( temporaryLine, STRING'("bad user type value checked, in file abro.esi, line 1"));
writeline( temporaryOutputFile, temporaryLine);
Assertion <= FAILURE;
else
sig_B_data <= text_to_data( STRING'("premier tirage"));
end if;
write( temporaryLine, STRING'("B = ""premier tirage"""));
writeline( temporaryOutputFile, temporaryLine);
sig_rst <= '0';
sig_A <= '0';
sig_R <= '0';
-- Sync on CLK rising edge --
WAIT UNTIL sig_clk'EVENT AND sig_clk = '1';
write( temporaryLine, STRING'("% Cycle 2"));
writeline( temporaryOutputFile, temporaryLine);
-- Log outputs to file --
WriteLogOutputs( temporaryOutputFile, sig_O, sig_O_data);
write( temporaryLine, STRING'(";"));
writeline( temporaryOutputFile, temporaryLine);
-- Outputs checking --
-----------------------------------
-- CLK cycle number: 3 --
-----------------------------------
-- Inputs initialization --
sig_A <= '1';
sig_A_data <= esterelString'("2" & (NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL));
write( temporaryLine, STRING'("A = ""2"""));
writeline( temporaryOutputFile, temporaryLine);
sig_rst <= '0';
sig_B <= '0';
sig_R <= '0';
-- Sync on CLK rising edge --
WAIT UNTIL sig_clk'EVENT AND sig_clk = '1';
write( temporaryLine, STRING'("% Cycle 3"));
writeline( temporaryOutputFile, temporaryLine);
-- Log outputs to file --
WriteLogOutputs( temporaryOutputFile, sig_O, sig_O_data);
write( temporaryLine, STRING'(";"));
writeline( temporaryOutputFile, temporaryLine);
-- Outputs checking --
-----------------------------------
-- CLK cycle number: 4 --
-----------------------------------
-- Inputs initialization --
sig_B <= '1';
if not check_data( STRING'("second tirage")) then
stop <= true;
write( temporaryLine, STRING'("bad user type value checked, in file abro.esi, line 6"));
writeline( temporaryOutputFile, temporaryLine);
Assertion <= FAILURE;
else
sig_B_data <= text_to_data( STRING'("second tirage"));
end if;
write( temporaryLine, STRING'("B = ""second tirage"""));
writeline( temporaryOutputFile, temporaryLine);
sig_rst <= '0';
sig_A <= '0';
sig_R <= '0';
-- Sync on CLK rising edge --
WAIT UNTIL sig_clk'EVENT AND sig_clk = '1';
write( temporaryLine, STRING'("% Cycle 4"));
writeline( temporaryOutputFile, temporaryLine);
-- Log outputs to file --
WriteLogOutputs( temporaryOutputFile, sig_O, sig_O_data);
write( temporaryLine, STRING'(";"));
writeline( temporaryOutputFile, temporaryLine);
-- Outputs checking --
-----------------------------------
-- CLK cycle number: 5 --
-----------------------------------
-- Inputs initialization --
if AssertionFlag then
if not(((sig_A_data = esterelString'("1" & (NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL,NUL))) and sig_B = '1')) then
Assertion <= NOTE;
write(temporaryLine, STRING'("% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"));
writeline( temporaryOutputFile, temporaryLine);
write(temporaryLine, STRING'("% NOTE: Break point reached"
& LF
& "% file 'abro.esi'"
& LF
& "% line '6'"));
writeline( temporaryOutputFile, temporaryLine);
write(temporaryLine, STRING'("% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" & LF));
writeline( temporaryOutputFile, temporaryLine);
ASSERT FALSE
REPORT LF
& "------------------------------"
& LF
& "-- NOTE: Break point reached in abro.esi, line 6"
& LF
& "------------------------------"
& LF
SEVERITY NOTE;
end if;
end if;
sig_R <= '1';
write( temporaryLine, STRING'("R"));
writeline( temporaryOutputFile, temporaryLine);
sig_rst <= '0';
sig_A <= '0';
sig_B <= '0';
-- Sync on CLK rising edge --
WAIT UNTIL sig_clk'EVENT AND sig_clk = '1';
write( temporaryLine, STRING'("% Cycle 5"));
writeline( temporaryOutputFile, temporaryLine);
-- Log outputs to file --
WriteLogOutputs( temporaryOutputFile, sig_O, sig_O_data);
write( temporaryLine, STRING'(";"));
writeline( temporaryOutputFile, temporaryLine);
-- Outputs checking --
-----------------------------------
-- CLK cycle number: 6 --
-----------------------------------
-- Inputs initialization --
-- A (""3"");
write( temporaryLine, STRING'("% "));
write( temporaryLine, STRING'("A (""3"");"));
writeline( temporaryOutputFile, temporaryLine);
-- B (""troisieme tirage"");
write( temporaryLine, STRING'("% "));
write( temporaryLine, STRING'("B (""troisieme tirage"");"));
writeline( temporaryOutputFile, temporaryLine);
stop <= true;
end process;
end ABRO_abro_MixedView;
Run-time Generated File: record_abro.eso | top |
% -----
% File record_abro.eso generated from Esterel module ABRO.
% -----
! reset;
A = "1";
% Cycle 1
;
B = "premier tirage"
% Cycle 2
;
% Cycle 3
;
% Output: O = "premier tirage"
;
B = "second tirage"
% Cycle 4
;
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOTE: Break point reached
% file 'abro.esi'
% line '8'
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
R
% Cycle 5
;
% A ("3");
% B ("troisieme tirage");