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

Subversion Repositories bubblesortmodule

[/] [bubblesortmodule/] [trunk/] [rtl/] [verilog/] [stageen.v] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 avramionut
//////////////////////////////////////////////////////////////////////
2
////
3
//// Copyright (C) 2014 avram ionut, avramionut@opencores.org
4
////
5
//// This source file may be used and distributed without
6
//// restriction provided that this copyright statement is not
7
//// removed from the file and that any derivative work contains
8
//// the original copyright notice and the associated disclaimer.
9
////
10
//// This source file is free software; you can redistribute it
11
//// and/or modify it under the terms of the GNU Lesser General
12
//// Public License as published by the Free Software Foundation;
13
//// either version 2.1 of the License, or (at your option) any
14
//// later version.
15
////
16
//// This source is distributed in the hope that it will be
17
//// useful, but WITHOUT ANY WARRANTY; without even the implied
18
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
19
//// PURPOSE. See the GNU Lesser General Public License for more
20
//// details.
21
////
22
//// You should have received a copy of the GNU Lesser General
23
//// Public License along with this source; if not, download it
24
//// from http://www.opencores.org/lgpl.shtml
25
////
26
//
27
// Revisions: 
28
// Revision 0.01 - File Created
29
// Additional Comments: 
30
//                     
31
//
32
//////////////////////////////////////////////////////////////////////////////////
33
module stageen #(parameter N_BITS=8)
34
(
35
    input   clk,
36
    input   load,
37
    input  [N_BITS-1:0] data_i,
38
    output [N_BITS-1:0] data_o,
39
    input   swap_i,
40
    output  swap_o,
41
    input   run_i,
42
    input   run_late_i,
43
    output  run_o,
44
    input   bit_i,
45
    output  bit_o,
46
    input   value_i,
47
    output  value_o
48
    );
49
 
50
    reg[N_BITS-1:0]    r_data;
51
 
52
    wire    w_large_bit;
53
    wire    w_small_bit;
54
    wire    w_swap_o;
55
    wire    w_run_o;
56
 
57
    always @(posedge clk)
58
        begin
59
            if (load) begin
60
                r_data <= data_i;                        end
61
            else if (run_i | run_late_i) begin
62
                r_data <= {r_data[N_BITS-2:0],value_i};  end
63
        end
64
 
65
    bitsplit split_module (
66
        .clk(clk),
67
        .bit1_i(bit_i),
68
        .bit2_i(r_data[N_BITS-1]),
69
        .largebit_o(w_large_bit),
70
        .smallbit_o(w_small_bit),
71
        .swap_i(swap_i),
72
        .swap_o(w_swap_o),
73
        .run_i(run_i),
74
        .run_o(w_run_o)
75
        );
76
 
77
    assign data_o = r_data;
78
    assign swap_o = w_swap_o;
79
    assign run_o = w_run_o;
80
    assign bit_o = w_large_bit;
81
    assign value_o = w_small_bit;
82
 
83
endmodule

powered by: WebSVN 2.1.0

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