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 Unchecked_Conversion;
|
with Unchecked_Conversion;
|
procedure biased_uc is
|
procedure biased_uc is
|
begin
|
begin
|
-- Case (f) target type is biased, source is unbiased
|
-- Case (f) target type is biased, source is unbiased
|
|
|
declare
|
declare
|
type a is new integer range 0 .. 255;
|
type a is new integer range 0 .. 255;
|
for a'size use 8;
|
for a'size use 8;
|
|
|
type b is new integer range 200 .. 455;
|
type b is new integer range 200 .. 455;
|
for b'size use 8;
|
for b'size use 8;
|
|
|
av : a;
|
av : a;
|
bv : b;
|
bv : b;
|
|
|
for av'size use 8;
|
for av'size use 8;
|
for bv'size use 8;
|
for bv'size use 8;
|
|
|
function a2b is new Unchecked_Conversion (a,b);
|
function a2b is new Unchecked_Conversion (a,b);
|
|
|
begin
|
begin
|
bv := a2b (200);
|
bv := a2b (200);
|
if bv = 200 then
|
if bv = 200 then
|
raise Program_Error;
|
raise Program_Error;
|
end if;
|
end if;
|
end;
|
end;
|
|
|
-- Case (g) target type is biased, source object is biased
|
-- Case (g) target type is biased, source object is biased
|
|
|
declare
|
declare
|
type a is new integer range 1 .. 256;
|
type a is new integer range 1 .. 256;
|
for a'size use 16;
|
for a'size use 16;
|
|
|
type b is new integer range 1 .. 65536;
|
type b is new integer range 1 .. 65536;
|
for b'size use 16;
|
for b'size use 16;
|
|
|
av : a;
|
av : a;
|
bv : b;
|
bv : b;
|
|
|
for av'size use 8;
|
for av'size use 8;
|
for bv'size use 16;
|
for bv'size use 16;
|
|
|
function a2b is new Unchecked_Conversion (a,b);
|
function a2b is new Unchecked_Conversion (a,b);
|
|
|
begin
|
begin
|
bv := a2b (1);
|
bv := a2b (1);
|
if bv /= 2 then
|
if bv /= 2 then
|
raise Program_Error;
|
raise Program_Error;
|
end if;
|
end if;
|
end;
|
end;
|
end;
|
end;
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.