quick.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

   

space.gif

   

space.gif

  ../../images/main/bullet_green_ball.gif Parity
   

space.gif

  ../../images/main/bulllet_4dots_orange.gif Using Assign
   

space.gif


  1 //-----------------------------------------------------
  2 // Design Name : parity_using_assign
  3 // File Name   : parity_using_assign.v
  4 // Function    : Parity using assign
  5 // Coder       : Deepak Kumar Tala
  6 //-----------------------------------------------------
  7 module parity_using_assign (
  8 data_in    , //  8 bit data in
  9 parity_out   //  1 bit parity out
 10 );
 11 output  parity_out ;
 12 input [7:0] data_in ; 
 13      
 14 wire parity_out ;
 15       
 16 assign parity_out =  (data_in[0] ^ data_in[1]) ^  
 17                      (data_in[2] ^ data_in[3]) ^ 
 18                      (data_in[4] ^ data_in[5]) ^  
 19                      (data_in[6] ^ data_in[7]);
 20 
 21 endmodule 
You could download file parity_using_assign.v here
   

space.gif

   

space.gif

  ../../images/main/bulllet_4dots_orange.gif Using function- I
   

space.gif


  1 //-----------------------------------------------------
  2 // Design Name : parity_using_function
  3 // File Name   : parity_using_function.v
  4 // Function    : Parity using function
  5 // Coder       : Deepak Kumar Tala
  6 //-----------------------------------------------------
  7 module parity_using_function (
  8 data_in    , //  8 bit data in
  9 parity_out   //  1 bit parity out
 10 );
 11 output  parity_out ;
 12 input [7:0] data_in ; 
 13      
 14 wire parity_out ; 
 15 
 16 function parity;
 17   input [31:0] data; 
 18   begin
 19     parity =  (data_in[0] ^ data_in[1]) ^  
 20               (data_in[2] ^ data_in[3]) ^ 
 21               (data_in[4] ^ data_in[5]) ^  
 22               (data_in[6] ^ data_in[7]);
 23   end 
 24 endfunction 
 25  
 26       
 27 assign parity_out = parity(data_in);
 28 
 29 endmodule
You could download file parity_using_function.v here
   

space.gif

  ../../images/main/bulllet_4dots_orange.gif Using function- II
   

space.gif


  1 //-----------------------------------------------------
  2 // Design Name : parity_using_function2
  3 // File Name   : parity_using_function2.v
  4 // Function    : Parity using function
  5 // Coder       : Deepak Kumar Tala
  6 //-----------------------------------------------------
  7 module parity_using_function2 (
  8 data_in    , //  8 bit data in
  9 parity_out   //  1 bit parity out
 10 );
 11 output  parity_out ;
 12 input [7:0] data_in ; 
 13      
 14 wire parity_out ;
 15 function parity;
 16   input [31:0] data; 
 17   integer i; 
 18   begin 
 19     parity = 0; 
 20     for (i = 0; i < 32; i = i + 1) begin  
 21       parity = parity ^ data[i]; 
 22     end 
 23   end 
 24 endfunction 
 25 
 26 always @ (data_in)
 27 begin
 28   parity_out = parity(data_in);
 29 end
 30 
 31 endmodule
You could download file parity_using_function2.v here
   

space.gif

  ../../images/main/bulllet_4dots_orange.gif And the Practical One
   

space.gif


  1 //-----------------------------------------------------
  2 // Design Name : parity_using_bitwise
  3 // File Name   : parity_using_bitwise.v
  4 // Function    : Parity using bitwise xor
  5 // Coder       : Deepak Kumar Tala
  6 //-----------------------------------------------------
  7 module parity_using_bitwise (
  8 data_in    , //  8 bit data in
  9 parity_out   //  1 bit parity out
 10 );
 11 output  parity_out ;
 12 input [7:0] data_in ; 
 13      
 14 assign parity_out = ^data_in; 
 15 
 16 endmodule
You could download file parity_using_bitwise.v here
   

space.gif

   

space.gif

   

space.gif

   

space.gif

space2.gif

space2.gif

space2.gif

space2.gif

space2.gif

  

Copyright © 1998-2014

Deepak Kumar Tala - All rights reserved

Do you have any Comment? mail me at:deepak@asic-world.com