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

Subversion Repositories tinyvliw8

[/] [tinyvliw8/] [trunk/] [src/] [vhdl/] [proc/] [regSet.vhd] - Blame information for rev 2

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

Line No. Rev Author Line
1 2 steckol
library ieee;
2
use ieee.std_logic_1164.all;
3
use ieee.std_logic_arith.all;
4
 
5
entity vliwProc_regSet is
6
        port (
7
                state  : in std_logic_vector(3 downto 0);
8
 
9
                reg0   : out std_logic_vector(7 downto 0);
10
                reg1   : out std_logic_vector(7 downto 0);
11
                reg2   : out std_logic_vector(7 downto 0);
12
                reg3   : out std_logic_vector(7 downto 0);
13
                reg4   : out std_logic_vector(7 downto 0);
14
                reg5   : out std_logic_vector(7 downto 0);
15
                reg6   : out std_logic_vector(7 downto 0);
16
                reg7   : out std_logic_vector(7 downto 0);
17
 
18
                irqEn  : in std_logic;
19
 
20
                aluDataIn  : in std_logic_vector(7 downto 0);
21
                aluRegSel  : in std_logic_vector(2 downto 0);
22
                aluRegEn_n : in std_logic;
23
 
24
                ldstDataIn  : in std_logic_vector(7 downto 0);
25
                ldstRegSel  : in std_logic_vector(2 downto 0);
26
                ldstRegEn_n : in std_logic;
27
 
28
                rst_n  : in std_logic
29
        );
30
end vliwProc_regSet;
31
 
32
architecture behavior of vliwProc_regSet is
33
 
34
        signal irqReg0_s : std_logic_vector(7 downto 0);
35
        signal irqReg1_s : std_logic_vector(7 downto 0);
36
        signal irqReg2_s : std_logic_vector(7 downto 0);
37
        signal irqReg3_s : std_logic_vector(7 downto 0);
38
 
39
        signal reg0_s : std_logic_vector(7 downto 0);
40
        signal reg1_s : std_logic_vector(7 downto 0);
41
        signal reg2_s : std_logic_vector(7 downto 0);
42
        signal reg3_s : std_logic_vector(7 downto 0);
43
        signal reg4_s : std_logic_vector(7 downto 0);
44
        signal reg5_s : std_logic_vector(7 downto 0);
45
        signal reg6_s : std_logic_vector(7 downto 0);
46
        signal reg7_s : std_logic_vector(7 downto 0);
47
 
48
        signal aluRegData_s  : std_logic_vector(7 downto 0);
49
        signal aluRegSel_s   : std_logic_vector(2 downto 0);
50
        signal aluCommit_s   : std_logic;
51
        signal ldstRegData_s : std_logic_vector(7 downto 0);
52
        signal ldstRegSel_s  : std_logic_vector(2 downto 0);
53
        signal ldstCommit_s  : std_logic;
54
 
55
        signal irqEn_s : std_logic;
56
 
57
BEGIN
58
 
59
        alu_commit_p : process(rst_n, state(2))
60
        begin
61
                if (rst_n = '0') then
62
                        aluRegData_s <= (others => '0');
63
                        aluRegSel_s <= (others => '0');
64
 
65
                        aluCommit_s <= '0';
66
                else
67
                        if (state(3)'event and state(3) = '1') then
68
                                if (aluRegEn_n <= '0') then
69
                                        aluRegSel_s <= aluRegSel;
70
                                        aluRegData_s <= aluDataIn;
71
 
72
                                        aluCommit_s <= '1';
73
                                else
74
                                        aluCommit_s <= '0';
75
                                end if;
76
                        end if;
77
                end if;
78
        end process;
79
 
80
        ldst_commit_p : process(rst_n, state(3))
81
        begin
82
                if (rst_n = '0') then
83
                        ldstRegData_s <= (others => '0');
84
                        ldstRegSel_s <= (others => '0');
85
 
86
                        ldstCommit_s <= '0';
87
                else
88
                        if (state(3)'event and state(3) = '1') then
89
                                if (ldstRegEn_n = '0') then
90
                                        ldstRegSel_s <= ldstRegSel;
91
                                        ldstRegData_s <= ldstDataIn;
92
 
93
                                        ldstCommit_s <= '1';
94
                                else
95
                                        ldstCommit_s <= '0';
96
                                end if;
97
                        end if;
98
                end if;
99
        end process;
100
 
101
        commit_p: process(rst_n, state(3))
102
        begin
103
                if (rst_n = '0') then
104
                        irqReg0_s <= (others => '0');
105
                        irqReg1_s <= (others => '0');
106
                        irqReg2_s <= (others => '0');
107
                        irqReg3_s <= (others => '0');
108
 
109
                        reg0_s <= (others => '0');
110
                        reg1_s <= (others => '0');
111
                        reg2_s <= (others => '0');
112
                        reg3_s <= (others => '0');
113
                        reg4_s <= (others => '0');
114
                        reg5_s <= (others => '0');
115
                        reg6_s <= (others => '0');
116
                        reg7_s <= (others => '0');
117
                elsif (state(3)'event and state(3) = '0') then
118
                        if (aluCommit_s = '1') then
119
                                if (aluRegSel_s = "000") then
120
                                        if (irqEn_s = '1') then
121
                                                irqReg0_s <= aluRegData_s;
122
                                        else
123
                                                reg0_s <= aluRegData_s;
124
                                        end if;
125
                                elsif (aluRegSel_s = "001") then
126
                                        if (irqEn_s = '1') then
127
                                                irqReg1_s <= aluRegData_s;
128
                                        else
129
                                                reg1_s <= aluRegData_s;
130
                                        end if;
131
                                elsif (aluRegSel_s = "010") then
132
                                        if (irqEn_s = '1') then
133
                                                irqReg2_s <= aluRegData_s;
134
                                        else
135
                                                reg2_s <= aluRegData_s;
136
                                        end if;
137
                                elsif (aluRegSel_s = "011") then
138
                                        if (irqEn_s = '1') then
139
                                                irqReg3_s <= aluRegData_s;
140
                                        else
141
                                                reg3_s <= aluRegData_s;
142
                                        end if;
143
                                elsif (aluRegSel_s = "100") then
144
                                        reg4_s <= aluRegData_s;
145
                                elsif (aluRegSel_s = "101") then
146
                                        reg5_s <= aluRegData_s;
147
                                elsif (aluRegSel_s = "110") then
148
                                        reg6_s <= aluRegData_s;
149
                                elsif (aluRegSel_s = "111") then
150
                                        reg7_s <= aluRegData_s;
151
                                end if;
152
                        end if;
153
 
154
                        if (ldstCommit_s = '1') then
155
                                if (ldstRegSel_s = "000") then
156
                                        if (irqEn_s = '1') then
157
                                                irqReg0_s <= ldstRegData_s;
158
                                        else
159
                                                reg0_s <= ldstRegData_s;
160
                                        end if;
161
                                elsif (ldstRegSel_s = "001") then
162
                                        if (irqEn_s = '1') then
163
                                                irqReg1_s <= ldstRegData_s;
164
                                        else
165
                                                reg1_s <= ldstRegData_s;
166
                                        end if;
167
                                elsif (ldstRegSel_s = "010") then
168
                                        if (irqEn_s = '1') then
169
                                                irqReg2_s <= ldstRegData_s;
170
                                        else
171
                                                reg2_s <= ldstRegData_s;
172
                                        end if;
173
                                elsif (ldstRegSel_s = "011") then
174
                                        if (irqEn_s = '1') then
175
                                                irqReg3_s <= ldstRegData_s;
176
                                        else
177
                                                reg3_s <= ldstRegData_s;
178
                                        end if;
179
                                elsif (ldstRegSel_s = "100") then
180
                                        reg4_s <= ldstRegData_s;
181
                                elsif (ldstRegSel_s = "101") then
182
                                        reg5_s <= ldstRegData_s;
183
                                elsif (ldstRegSel_s = "110") then
184
                                        reg6_s <= ldstRegData_s;
185
                                elsif (ldstRegSel_s = "111") then
186
                                        reg7_s <= ldstRegData_s;
187
                                end if;
188
                        end if;
189
                end if;
190
        end process;
191
 
192
        -- commit interrupt signal after commit of registers, but before access of
193
        -- functional units
194
        irqEn_proc: process(rst_n, state(1))
195
        begin
196
                if (rst_n = '0') then
197
                        irqEn_s <= '0';
198
                else
199
                        if (state(1)'event and state(1) = '0') then
200
                                irqEn_s <= irqEn;
201
                        end if;
202
                end if;
203
        end process;
204
 
205
        -- output including alu fast forward
206
        reg0 <= irqReg0_s    when irqEn_s = '1' else
207
                reg0_s;
208
        reg1 <= irqReg1_s when irqEn_s = '1' else
209
                reg1_s;
210
        reg2 <= irqReg2_s when irqEn_s = '1' else
211
                reg2_s;
212
        reg3 <= irqReg3_s when irqEn_s = '1' else
213
                reg3_s;
214
        reg4 <= reg4_s;
215
        reg5 <= reg5_s;
216
        reg6 <= reg6_s;
217
        reg7 <= reg7_s;
218
 
219
END behavior;

powered by: WebSVN 2.1.0

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