URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 304 |
Rev 384 |
-- { dg-do run }
|
-- { dg-do run }
|
-- { dg-options "-gnatws" }
|
-- { dg-options "-gnatws" }
|
|
|
with Ada.Unchecked_Conversion;
|
with Ada.Unchecked_Conversion;
|
|
|
procedure Unchecked_Convert1 is
|
procedure Unchecked_Convert1 is
|
type Byte is mod 2**8;
|
type Byte is mod 2**8;
|
|
|
type Stream is array (Natural range <>) of Byte;
|
type Stream is array (Natural range <>) of Byte;
|
|
|
type Rec is record
|
type Rec is record
|
I1, I2 : Integer;
|
I1, I2 : Integer;
|
end record;
|
end record;
|
|
|
function Do_Sum (R : Rec) return Integer is
|
function Do_Sum (R : Rec) return Integer is
|
begin
|
begin
|
return R.I1 + R.I2;
|
return R.I1 + R.I2;
|
end;
|
end;
|
|
|
function Sum (S : Stream) return Integer is
|
function Sum (S : Stream) return Integer is
|
subtype Chunk is Stream (1 .. Rec'Size / 8);
|
subtype Chunk is Stream (1 .. Rec'Size / 8);
|
function To_Chunk is new Ada.Unchecked_Conversion (Chunk, Rec);
|
function To_Chunk is new Ada.Unchecked_Conversion (Chunk, Rec);
|
begin
|
begin
|
return Do_Sum (To_Chunk (S(S'First .. S'First + Rec'Size / 8 - 1)));
|
return Do_Sum (To_Chunk (S(S'First .. S'First + Rec'Size / 8 - 1)));
|
end;
|
end;
|
|
|
A : Stream (1..9);
|
A : Stream (1..9);
|
I : Integer;
|
I : Integer;
|
|
|
begin
|
begin
|
I := Sum (A(1..8));
|
I := Sum (A(1..8));
|
end;
|
end;
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.