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

Subversion Repositories i650

[/] [i650/] [trunk/] [rtl/] [digit_pulse.v] - Blame information for rev 16

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 16 eightycc
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// IBM 650 Reconstruction in Verilog (i650)
4
// 
5
// This file is part of the IBM 650 Reconstruction in Verilog (i650) project
6
// http:////www.opencores.org/project,i650
7
//
8
// Description: Digit time pulse generator. Emits a pulse lasting 1 digit time
9
//    beginning at the first rising clk edge at/after in_pulse becomes true,
10
//    approximating rising-edge triggering by in_pulse.
11
// 
12
// Additional Comments: Input init_history is a 0 for rising egde tiggering.
13
//    For falling edge triggering, set in_pulse to the complement of the signal
14
//    and set init_history to 1.
15
//
16
// Copyright (c) 2015 Robert Abeles
17
//
18
// This source file is free software; you can redistribute it
19
// and/or modify it under the terms of the GNU Lesser General
20
// Public License as published by the Free Software Foundation;
21
// either version 2.1 of the License, or (at your option) any
22
// later version.
23
//
24
// This source is distributed in the hope that it will be
25
// useful, but WITHOUT ANY WARRANTY; without even the implied
26
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
27
// PURPOSE.  See the GNU Lesser General Public License for more
28
// details.
29
//
30
// You should have received a copy of the GNU Lesser General
31
// Public License along with this source; if not, download it
32
// from http://www.opencores.org/lgpl.shtml
33
//////////////////////////////////////////////////////////////////////////////////
34
 
35
module digit_pulse (
36
   input rst, clk,
37
   input in_pulse,
38
   input init_history,
39
   output reg out_pulse
40
   );
41
 
42
        reg history;
43
 
44
        always @(posedge clk) begin
45
                if (rst) begin
46
                        out_pulse <= 0;
47
                        history <= init_history;
48
                end else if (out_pulse) begin
49
                        out_pulse <= 0;
50
                end else if (in_pulse) begin
51
                        out_pulse <= ~history;
52
                        history <= 1;
53
                end else begin
54
                        history <= 0;
55
                end
56
        end;
57
endmodule

powered by: WebSVN 2.1.0

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