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

Subversion Repositories hive

[/] [hive/] [trunk/] [v01.09/] [thread_ring.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 ericw
/*
2
--------------------------------------------------------------------------------
3
 
4
Module : thread_ring.v
5
 
6
--------------------------------------------------------------------------------
7
 
8
Function:
9
- Processor thread pipeline.
10
 
11
Instantiates:
12
- Nothing.
13
 
14
Notes:
15
- 8 stage pipeline.
16
- Counter in stage 0 ensures long-term correct operation.
17
 
18
--------------------------------------------------------------------------------
19
*/
20
 
21
module thread_ring
22
        #(
23
        parameter       integer                                                 THRD_W                          = 3  // thread width
24
        )
25
        (
26
        // clocks & resets
27
        input                   wire                                                            clk_i,  // clock
28
        input                   wire                                                            rst_i,  // async. reset, active high
29
        // threads
30
        output          reg     [THRD_W-1:0]                     thrd_0_o,
31
        output          reg     [THRD_W-1:0]                     thrd_1_o,
32
        output          reg     [THRD_W-1:0]                     thrd_2_o,
33
        output          reg     [THRD_W-1:0]                     thrd_3_o,
34
        output          reg     [THRD_W-1:0]                     thrd_4_o,
35
        output          reg     [THRD_W-1:0]                     thrd_5_o,
36
        output          reg     [THRD_W-1:0]                     thrd_6_o,
37
        output          reg     [THRD_W-1:0]                     thrd_7_o
38
        );
39
 
40
 
41
        /*
42
        ----------------------
43
        -- internal signals --
44
        ----------------------
45
        */
46
 
47
 
48
        /*
49
        ================
50
        == code start ==
51
        ================
52
        */
53
 
54
 
55
        // pipeline thread
56
        always @ ( posedge clk_i or posedge rst_i ) begin
57
                if ( rst_i ) begin
58
                        thrd_0_o <= 'd5;
59
                        thrd_1_o <= 'd4;
60
                        thrd_2_o <= 'd3;
61
                        thrd_3_o <= 'd2;
62
                        thrd_4_o <= 'd1;
63
                        thrd_5_o <= 'd0;
64
                        thrd_6_o <= 'd7;
65
                        thrd_7_o <= 'd6;
66
                end else begin
67
                        thrd_0_o <= thrd_0_o + 1'b1;  // note: counter terminus
68
                        thrd_1_o <= thrd_0_o;
69
                        thrd_2_o <= thrd_1_o;
70
                        thrd_3_o <= thrd_2_o;
71
                        thrd_4_o <= thrd_3_o;
72
                        thrd_5_o <= thrd_4_o;
73
                        thrd_6_o <= thrd_5_o;
74
                        thrd_7_o <= thrd_6_o;
75
                end
76
        end
77
 
78
 
79
endmodule

powered by: WebSVN 2.1.0

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