`timescale 1ns/1ps /*module lazyOR ( // directions N, E, S, W, //clock status status //, // rotation //R ); module lazyAND ( // directions N, E, S, W, //clock status status //, // rotation //R ); module Diode ( // directions N, E, S, W, //clock status status //, // rotation //R ); */ module MQCAcell ( // directions N, E, S, W, //output value, //clock status status ); function integer bintopol; // conversion function from binary to polarization input a; // input argument port case (a) 1'b0: bintopol = -1; 1'b1: bintopol = 1; 1'bz: bintopol = 0; 1'bx: bintopol = 0; endcase endfunction function compute; // function definition input N, E, S, W; integer polarization; begin polarization = bintopol(N) + bintopol(S) - 1*(bintopol(E) + bintopol(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; input N, E, S, W; input R; input [1:0] status; output value; reg value; always @(status,N,E,S,W) begin if (status == reset) //reset value <= 1'bz; else if (value === 1'bz) value<= #1 compute(N,E,S,W); end endmodule // QCAcell