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

Subversion Repositories hive

[/] [hive/] [trunk/] [v01.09/] [stacks_mux.v] - Blame information for rev 12

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

Line No. Rev Author Line
1 2 ericw
/*
2
--------------------------------------------------------------------------------
3
 
4
Module : stacks_mux.v
5
 
6
--------------------------------------------------------------------------------
7
 
8
Function:
9
- Output multiplexer for processor stacks.
10
 
11
Instantiates:
12
- (1x) vector_sr.v
13
 
14
Notes:
15
- Purely combinatorial.
16
 
17
--------------------------------------------------------------------------------
18
*/
19
 
20
module stacks_mux
21
        #(
22
        parameter       integer                                                 DATA_W                  = 32,           // data width
23
        parameter       integer                                                 STK_W                           = 2,            // stack selector width
24
        parameter       integer                                                 IM_DATA_W               = 8             // immediate data width
25
        )
26
        (
27
        // control I/O
28
        input                   wire    [STK_W-1:0]                              a_sel_i,                                                // stack selector
29
        input                   wire    [STK_W-1:0]                              b_sel_i,                                                // stack selector
30
        input                   wire                                                            imda_i,                                         // 1=immediate data
31
        // data I/O
32
        input                   wire    [DATA_W-1:0]                     pop_data0_i,                            // stack data
33
        input                   wire    [DATA_W-1:0]                     pop_data1_i,                            // stack data
34
        input                   wire    [DATA_W-1:0]                     pop_data2_i,                            // stack data
35
        input                   wire    [DATA_W-1:0]                     pop_data3_i,                            // stack data
36
        input                   wire    [IM_DATA_W-1:0]          im_data_i,                                      // immediate data
37
        //
38
        output          wire    [DATA_W-1:0]                     a_o,                                            // results
39
        output          wire    [DATA_W-1:0]                     b_o,
40
        output          wire    [DATA_W-1:0]                     b_alu_o
41
        );
42
 
43
 
44
        /*
45
        ----------------------
46
        -- internal signals --
47
        ----------------------
48
        */
49
        reg                                     [DATA_W-1:0]                     a, b;
50
 
51
 
52
        /*
53
        ================
54
        == code start ==
55
        ================
56
        */
57
 
58
 
59
        // mux stack read data
60
        always @ ( * ) begin
61
                case ( a_sel_i )
62
                        'b00 : a <= pop_data0_i;
63
                        'b01 : a <= pop_data1_i;
64
                        'b10 : a <= pop_data2_i;
65
                        'b11 : a <= pop_data3_i;
66
                endcase
67
        end
68
 
69
        // mux stack read data
70
        always @ ( * ) begin
71
                case ( b_sel_i )
72
                        'b00 : b <= pop_data0_i;
73
                        'b01 : b <= pop_data1_i;
74
                        'b10 : b <= pop_data2_i;
75
                        'b11 : b <= pop_data3_i;
76
                endcase
77
        end
78
 
79
        // output
80
        assign a_o = a;
81
        assign b_o = b;
82
        assign b_alu_o = ( imda_i ) ? $signed( im_data_i ) : $signed( b );
83
 
84
 
85
endmodule

powered by: WebSVN 2.1.0

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