top.v 1.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
// File: design.v
// Generated by MyHDL 0.8
// Date: Tue Dec  3 04:33:14 2013


`timescale 1ns/10ps

module top (
    x,clk,rst,a
);

output x;
reg x;
input clk;
input rst;
input [1:0] a;

SergeyDegtyar committed
18
`ifndef BUG
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46
always @(posedge clk, negedge rst) begin: DESIGN_PROCESSOR
    reg i;
    if (!rst) begin
        i = 0;
        x = 0;
    end
    else begin
        case (a)
            2'b00: begin
				x = 0;
                i = 0;
            end
            2'b01: begin
                x = i;
            end
            2'b10: begin
                i = 1;
            end
            2'b11: begin
                i = 0;
            end
            default: begin
                x = 0;
                i = 0;
            end
        endcase
    end
end
SergeyDegtyar committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
    `else
    always @(posedge clk, negedge rst) begin: DESIGN_PROCESSOR
    reg i;
    if (!rst) begin
        i = 0;
        x = 0;
    end
    else begin
        case (a)
            2'b00: begin
				x = 1'bZ;
                i = 0;
            end
            2'b01: begin
                x = 1'bZ;
            end
            2'b10: begin
                i = 1;
            end
            2'b11: begin
                i = 0;
            end
            default: begin
                x = 1'bZ;
                i = 0;
            end
        endcase
    end
end
`endif
77
endmodule