~ubuntu-branches/ubuntu/wily/verilator/wily-proposed

« back to all changes in this revision

Viewing changes to test_regress/t/t_math_signed6.v

  • Committer: Package Import Robot
  • Author(s): أحمد المحمودي (Ahmed El-Mahmoudy)
  • Date: 2015-04-26 16:20:52 UTC
  • mfrom: (4.1.5 experimental)
  • Revision ID: package-import@ubuntu.com-20150426162052-69yjwh512m0adl2k
Tags: 3.872-2
* Upload to unstable.
* debian/patches/*: Added DEP-3 patch headers.
* Remove debian/gbp.conf, not needed in master branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// DESCRIPTION: Verilator: Verilog Test module
 
2
//
 
3
// This file ONLY is placed into the Public Domain, for any use,
 
4
// without warranty, 2015 by Iztok Jeras.
 
5
 
 
6
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d:  got='h%x exp='h%x\n", `__FILE__,`__LINE__, (gotv), (expv)); $stop; end while(0)
 
7
 
 
8
  module t (/*AUTOARG*/);
 
9
 
 
10
   // signed source
 
11
   logic   signed  [8-1:0] src;
 
12
 
 
13
   // destination structure
 
14
   struct packed {
 
15
     logic   signed [16-1:0] s;
 
16
     logic unsigned [16-1:0] u;
 
17
   } dst;
 
18
 
 
19
   initial begin
 
20
      // bug882
 
21
      // verilator lint_off WIDTH
 
22
      src = 8'sh05;
 
23
      dst = '{s: src, u: src};
 
24
      `checkh (dst.s, 16'h0005);
 
25
      `checkh (dst.u, 16'h0005);
 
26
 
 
27
      src = 8'shf5;
 
28
      dst = '{s: src, u: src};
 
29
      `checkh (dst.s, 16'hfff5);
 
30
      `checkh (dst.u, 16'hfff5);
 
31
      // verilator lint_on WIDTH
 
32
 
 
33
      $write("*-* All Finished *-*\n");
 
34
      $finish;
 
35
   end
 
36
endmodule