OpenCores
URL https://opencores.org/ocsvn/fpga-cf/fpga-cf/trunk

Subversion Repositories fpga-cf

[/] [fpga-cf/] [trunk/] [hdl/] [PATLPP/] [microcodelogic/] [microcodelogic.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 peteralieb
// Microcode support logic
2
// Author: Peter Lieber
3
//
4
 
5
module microcodelogic
6
(
7
        input           wire                            clk,
8
        input           wire                            rst,
9
        output  wire                            srst,
10
 
11
        input           wire                            sof_in,
12
        input           wire                            eof_in,
13
        input           wire                            src_rdy_in,
14
        output  wire                            dst_rdy_in, //
15
 
16
        output  wire                            sof_out, //
17
        output  wire                            eof_out, //
18
        output  wire                            src_rdy_out, //
19
        input           wire                            dst_rdy_out,
20
 
21
        output  wire                            high_byte_reg_en, //
22
        output  wire                            output_byte_s,
23
        output  wire                            outport_reg_en,
24
        output  wire                            inport_reg_en,
25
        output  wire    [2:0]            data_mux_s,
26
        output  wire    [1:0]            op_0_s,
27
        output  wire                            op_1_s,
28
 
29
        output  wire    [3:0]            reg_addr, //
30
        output  wire    [1:0]            reg_wen, //
31
 
32
        output  wire                            fcs_add,
33
        output  wire                            fcs_clear,
34
        input           wire                            fcs_check,
35
 
36
        output  wire                            sr1_in_en, //
37
        output  wire                            sr2_in_en, //
38
        output  wire                            sr1_out_en, //
39
        output  wire                            sr2_out_en, //
40
 
41
        output  wire                            flag_reg_en,
42
 
43
        output  wire    [2:0]            comp_mode, //
44
        input           wire                            comp_res,
45
 
46
        output  wire    [1:0]            alu_op, //
47
 
48
        output  wire    [7:0]            const_byte,
49
        output  wire    [15:0]   const_word//, // Word Constant
50
        //output        wire    [7:0]           chipscope_data
51
);
52
 
53
reg     [8:0]            pc;
54
wire    [66:0]   instruction_word; // entire instruction word
55
wire                            pred_src_rdy; // source ready predicated execution
56
wire                            pred_dst_rdy; // destination ready predicated execution
57
wire                            pred_comp; // compare true predicated execution
58
wire                            pred_sof; // Start of Frame predicated execution
59
wire                            pred_eof; // End of Frame predicated execution
60
wire                            pred_cs; // Checksum Predicate
61
wire                            pred; // execution enabling predicate composite
62
wire    [1:0]            pred_type; // type of predication: until(0) or when(1) or if(2)
63
wire                            reset; // reset program to pc=0
64
wire                            jump; // Jump flag
65
wire    [8:0]            const_jmp;
66
 
67
// Chipscope
68
//assign chipscope_data = pc[7:0];
69
 
70
microcodesrc codesource (
71
        .addr(pc),
72
        .code(instruction_word)
73
);
74
 
75
assign pred                                     = ((pred_src_rdy == 0 && pred_dst_rdy == 0 && pred_comp == 0 && pred_sof == 0 && pred_eof == 0 && pred_cs == 0) ||
76
                                                                        !((pred_src_rdy == 1 && src_rdy_in == 0) ||
77
                                                                          (pred_dst_rdy == 1 && dst_rdy_out == 0) ||
78
                                                                          (pred_comp == 1 && comp_res == 0) ||
79
                                                                     (pred_sof == 1 && sof_in == 0) ||
80
                                                                     (pred_eof == 1 && eof_in == 0) ||
81
                                                                          (pred_cs == 1 && fcs_check == 0)));
82
 
83
assign const_word                               = instruction_word[15:0];
84
assign const_jmp                                = instruction_word[24:16];
85
 
86
assign alu_op                                   = instruction_word[26:25];
87
assign comp_mode                                = instruction_word[29:27];
88
 
89
assign flag_reg_en                      = instruction_word[30] & (pred | (pred_type == 1));
90
 
91
assign sr2_out_en                               = instruction_word[31] & (pred | (pred_type == 1));
92
assign sr1_out_en                               = instruction_word[32] & (pred | (pred_type == 1));
93
assign sr2_in_en                                = instruction_word[33] & (pred | (pred_type == 1));
94
assign sr1_in_en                                = instruction_word[34] & (pred | (pred_type == 1));
95
 
96
assign fcs_clear                                = instruction_word[35] & (pred | (pred_type == 1));
97
assign fcs_add                                  = instruction_word[36] & (pred | (pred_type == 1));
98
 
99
assign reg_wen                                  = instruction_word[38:37] & {2{(pred | (pred_type == 1))}};
100
assign reg_addr                         = instruction_word[42:39];
101
 
102
assign op_1_s                                   = instruction_word[43];
103
assign op_0_s                                   = instruction_word[45:44];
104
assign data_mux_s                               = instruction_word[48:46];
105
assign inport_reg_en                    = instruction_word[49];
106
assign outport_reg_en           = instruction_word[50];
107
assign output_byte_s                    = instruction_word[51];
108
assign high_byte_reg_en         = instruction_word[52];
109
 
110
assign pred_src_rdy                     = instruction_word[53];
111
assign pred_dst_rdy                     = instruction_word[54];
112
assign pred_comp                                = instruction_word[55];
113
assign pred_sof                         = instruction_word[56];
114
assign pred_eof                         = instruction_word[57];
115
assign pred_cs                                  = instruction_word[58];
116
assign pred_type                                = instruction_word[60:59];
117
 
118
assign eof_out                                  = instruction_word[61];// & (pred);// | pred_type);
119
assign sof_out                                  = instruction_word[62];// & (pred);// | pred_type);
120
assign src_rdy_out                      = instruction_word[63];// & (pred | (pred_type == 1));
121
assign dst_rdy_in                               = instruction_word[64];// & (pred | (pred_type == 1));
122
 
123
assign reset                                    = instruction_word[65] & (pred);
124
assign jump                                             = instruction_word[66] & (pred);
125
 
126
assign srst                                             = reset;
127
assign const_byte                               = const_jmp[7:0];
128
 
129
// Microcode PC control
130
always@(posedge clk)
131
begin
132
        if (rst == 1)
133
        begin
134
                pc <= 0;
135
        end
136
        else    if (reset)
137
        begin
138
                pc <= 0;
139
        end
140
        else if (jump)
141
        begin
142
                pc <= const_jmp;
143
        end
144
        else if (pred || (pred_type == 2))
145
        begin
146
                pc <= pc + 1;
147
        end
148
end
149
 
150
endmodule

powered by: WebSVN 2.1.0

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