`timescale 1ns/1ps /*module lazyOR ( // directions N, E, S, W, //clock status status //, // rotation //R ); */ module lazyAND ( // directions in1, in2, out, //clock status status //, // rotation //R ); function integer Lbintopol; // conversion function from binary to polarization input a; // input argument port case (a) 1'b0: Lbintopol = -1; 1'b1: Lbintopol = 0; 1'bz: Lbintopol = 0; 1'bx: Lbintopol = 0; endcase endfunction function compute; // function definition input N, E, S, W; integer polarization; begin polarization = Lbintopol(N) + Lbintopol(S) - 1*(Lbintopol(E) + Lbintopol(W)); if ( polarization > 0) compute = 1'b1; else if ( polarization < 0) compute = 1'b0; else compute =1'bz; end endfunction // compute // //status 00=relax,01=switch, 10=hold, 11=release parameter reset=2'b00; parameter switch=2'b01; parameter hold=2'b10; // //status 00=relax,01=switch, 10=hold, 11=release input in1,in2; input [1:0] status; output value; reg value; always @(status,in1,in2) begin if (status == reset) //reset value <= 1'bz; else if (value === 1'bz) value<= #1 compute(in1,1'bz,in2,1'bz); end endmodule // QCAcell