相关代码 |
|
module Parity_Check; reg [0:7] a; reg s; initial begin a=8'b11000111; end function Parity; input [0:7] Set; //output Parity; //reg Parity; reg[0:2] Ret; integer j; begin Ret=0; for(j=0;j if(Set[j]==1) Ret=Ret+1; end Parity=Ret%2; end endfunction initial begin s=Parity(a); $display("a=%b,s=%b",a,s); end endmodule
相关资源 |
|