aboutsummaryrefslogtreecommitdiffstats
path: root/example/interesting.v
blob: c76f92a1c4d3bc1a868ee2934caf1b70e22b31c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
module top(a, x);
   reg [3:0] tmp;
   input [3:0] a;
   output reg [3:0] x;

   always @* begin
      x = tmp;
      tmp = a;
   end
endmodule // top

`ifndef SYNTHESIS
/* Generated by Yosys 0.9+2406 (git sha1 000fd08198, clang++ 7.1.0 -fPIC -Os) */
module top_synth(a, x);
  input [3:0] a;
  wire [3:0] tmp;
  output [3:0] x;
  assign tmp = a;
  assign x = a;
endmodule

module main;
   reg [3:0] a;
   wire [3:0] x, x_synth;

   top top(a, x);
   top_synth top_synth(a, x_synth);

   initial begin
      a = 0;
      #10 a = 1;
      #10 $display("x: %d\nx_synth: %d", x, x_synth);
      $finish;
   end
endmodule
`endif