OpenCores
URL https://opencores.org/ocsvn/versatile_library/versatile_library/trunk

Subversion Repositories versatile_library

[/] [versatile_library/] [trunk/] [rtl/] [verilog/] [registers.v] - Diff between revs 3 and 5

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 3 Rev 5
Line 55... Line 55...
        else
        else
                q <= d;
                q <= d;
 
 
endmodule
endmodule
 
 
 
module dff_array ( d, q, clk, rst);
 
 
 
        parameter width = 1;
 
        parameter depth = 2;
 
        parameter reset_value = 1'b0;
 
 
 
        input [width-1:0] d;
 
        input clk, rst;
 
        output [width-1:0] q;
 
        reg  [0:depth-1] q_tmp [width-1:0];
 
        integer i;
 
        always @ (posedge clk or posedge rst)
 
        if (rst) begin
 
            for (i=0;i<depth;i=i+1)
 
                q_tmp[i] <= {width{reset_value}};
 
        end else begin
 
            q_tmp[0] <= d;
 
            for (i=1;i<depth;i=i+1)
 
                q_tmp[i] <= q_tmp[i-1];
 
        end
 
 
 
    assign q = q_tmp[depth-1];
 
 
 
endmodule
 
 
module dff_ce ( d, ce, q, clk, rst);
module dff_ce ( d, ce, q, clk, rst);
 
 
        parameter width = 1;
        parameter width = 1;
        parameter reset_value = 0;
        parameter reset_value = 0;
 
 
Line 217... Line 242...
 
 
endmodule
endmodule
 
 
`endif
`endif
 
 
 No newline at end of file
 No newline at end of file
 
// LATCH
 
// For targtes not supporting LATCH use dff_sr with clk=1 and data=1
 
`ifdef ALTERA
 
module latch ( d, le, q, clk);
 
input d, le;
 
output q;
 
input clk;
 
dff_sr i0 (.aclr(), .aset(), .clock(1'b1), .data(1'b1), .q(q));
 
endmodule
 
`else
 
module latch ( d, le, q, clk);
 
input d, le;
 
output q;
 
input clk;/*
 
   always @ (posedge direction_set or posedge direction_clr)
 
     if (direction_clr)
 
       direction <= going_empty;
 
     else
 
       direction <= going_full;*/
 
endmodule
 
`endif
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.