Saturday 4 February 2012

verilog code for ACCUMULATOR


Verilog code for a 4-bit unsigned up accumulator with an asynchronous clear.
        module accum (clk, clr, d, q);
        input        clk, clr;
        input  [3:0] d;
        output [3:0] q;
        reg    [3:0] tmp;
        always @(posedge clk or posedge clr)
        begin
           if (clr)
              tmp <= 4’b0000;
           else
              tmp <= tmp + d;
        end
           assign q = tmp;
        endmodule
        

8 comments:

  1. Showing an error..Syntax error !!!

    ReplyDelete
  2. change ’ to '

    ReplyDelete
  3. Wat is accumulator

    ReplyDelete
  4. can any one send verilog code for 3X3 matrix multiplication using memory

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete
  6. to get correct output use this:
    if (clr)
    tmp <= 0;
    else
    tmp <= d;
    end

    ReplyDelete
  7. accumulator is a storing register memory for the logical and arithmetic data in cpu,

    ReplyDelete
  8. PLS SEND CODE FOR VEDIC MULTIPLIER USING YAVADANUM FORMULA
    MAIL ID:dorathyabisha@gmail.com

    ReplyDelete