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

Subversion Repositories rtf8088

[/] [rtf8088/] [trunk/] [rtl/] [verilog/] [FETCH_IMMEDIATE.v] - Blame information for rev 8

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 robfinch
// ============================================================================
2
//  FETCH_IMM16
3
//  - fetch 16 bit immediate from instruction stream as operand 'B'
4
//  FETCH_IMM8
5
//  - Fetch 8 bit immediate as operand 'B'
6
//
7
//
8
//  2009-2012  Robert Finch
9 8 robfinch
//  robfinch[remove]@finitron.ca
10 2 robfinch
//  Stratford
11
//
12
// This source file is free software: you can redistribute it and/or modify 
13
// it under the terms of the GNU Lesser General Public License as published 
14
// by the Free Software Foundation, either version 3 of the License, or     
15
// (at your option) any later version.                                      
16
//                                                                          
17
// This source file is distributed in the hope that it will be useful,      
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
20
// GNU General Public License for more details.                             
21
//                                                                          
22
// You should have received a copy of the GNU General Public License        
23
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
24
//
25
//
26
//  Verilog 
27
//
28
// - bus is locked if immediate value is unaligned in memory
29
// - immediate values are the last operand to be fetched, hence
30
//   the state machine can transition into the EXECUTE state.
31
// - we also know the immediate value can't be the target of an
32
//   operation.
33
// ============================================================================
34
//
35
FETCH_IMM8:
36
        begin
37 8 robfinch
                code_read();
38 2 robfinch
                state <= FETCH_IMM8_ACK;
39
        end
40
 
41
FETCH_IMM8_ACK:
42
        if (ack_i) begin
43 8 robfinch
                term_code_read();
44 2 robfinch
                lock_o <= bus_locked;
45
                b <= {{8{dat_i[7]}},dat_i};
46
                state <= EXECUTE;
47
        end
48
 
49
FETCH_IMM16:
50
        begin
51
                lock_o <= 1'b1;
52 8 robfinch
                code_read();
53 2 robfinch
                state <= FETCH_IMM16_ACK;
54
        end
55
FETCH_IMM16_ACK:
56
        if (ack_i) begin
57 8 robfinch
                pause_code_read();
58 2 robfinch
                state <= FETCH_IMM16a;
59
                b[ 7:0] <= dat_i;
60
        end
61
FETCH_IMM16a:
62
        begin
63 8 robfinch
                continue_code_read();
64 2 robfinch
                state <= FETCH_IMM16a_ACK;
65
        end
66
FETCH_IMM16a_ACK:
67
        if (ack_i) begin
68 8 robfinch
                term_code_read();
69 2 robfinch
                lock_o <= bus_locked;
70
                b[15:8] <= dat_i;
71
                $display("Fetched #%h", {dat_i,b[7:0]});
72
                state <= EXECUTE;
73
        end
74
 

powered by: WebSVN 2.1.0

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