top.v 1.35 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
// 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 [2:0] rst;
input [1:0] a;

wire rst_or;

assign rst_or = |rst;
SergeyDegtyar committed
21
`ifndef BUG
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 47 48 49 50
always @(posedge clk, negedge rst_or) begin: DESIGN_PROCESSOR
    reg i;
    if (!rst_or) 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
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 77 78 79 80
    `else
always @(posedge clk, negedge rst_or) begin: DESIGN_PROCESSOR
    reg i;
    if (!rst_or) 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
81
endmodule