Commit ab57efa5 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Improve SDL semantic checks

parent 1b799952
......@@ -22,32 +22,51 @@ package body TASTE.Semantic_Check is
-- Allow case insensitive checks of unbounded strings:
function "="(A, B : Unbounded_String) return Boolean is
(To_Lower (To_String (A)) = (To_Lower (To_String (B))));
Error_Found : Boolean := False;
begin
-- Checks done when generating skeletons
for Each of Model.Interface_View.Flat_Functions loop
-- SDL functions
if Each.Language = "sdl" then
for PI of Each.Provided loop
-- Check that PIs and RIs have different names
-- Check that if a PI and a RI have the same name, they
-- also have the same interface (since they are translated
-- to a single "signal" in SDL)
for RI of Each.Required loop
if PI.Name = RI.Name then -- Case insensitive check
raise Semantic_Error with
"In SDL function " & To_String (Each.Name) & ": PI and "
& "RI names shall be different - "
& To_String (PI.Name);
if PI.Params.Length /= RI.Params.Length then
Error_Found := True;
else
for I in PI.Params.First_Index .. PI.Params.Last_Index
loop
-- Compare each param (name + type)
if PI.Params (I).Name /= RI.Params (I).Name
or PI.Params (I).Sort /= RI.Params (I).Sort
then
Error_Found := True;
end if;
end loop;
end if;
if Error_Found then
raise Semantic_Error with
"In SDL function " & To_String (Each.Name)
& ": PI and RI signatures shall be identical when "
& "interfaces have the same name - "
& To_String (PI.Name);
end if;
end if;
end loop;
-- Check that PIs have one IN parameter at most
-- Removed that check: sync interfaces with multiple params
-- are now supported
-- if PI.Params.Length > 1 or (PI.Params.Length = 1 and
-- (for all Param of PI.Params => Param.Direction /= param_in))
-- then
-- raise Semantic_Error with
-- "In SDL function " & To_String (Each.Name) & ": all PIs "
-- & "shall be sporadic and/or have a single IN parameter "
-- & "(fix " & To_String (PI.Name) & ")";
-- end if;
-- Check that sporadic inputs only have one IN param at most
if PI.RCM = Sporadic_Operation and then
(PI.Params.Length > 1 or (PI.Params.Length = 1 and
(for all Param of PI.Params => Param.Direction /= param_in)))
then
raise Semantic_Error with
"In SDL function " & To_String (Each.Name) & ": sporadic "
& "interfaces shall have at most one IN parameter "
& "(fix " & To_String (PI.Name) & ")";
end if;
end loop;
end if;
end loop;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment