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

Subversion Repositories brisc

[/] [brisc/] [trunk/] [brisc.v] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 waqqas.jab
module trisc(cond, out_sig, clk, reset_n);
2
 
3
//independent parameters
4
parameter ncs = 3;                      //number of bits to select cw+1 inputs i.e 2^ncs = (cw+1)
5
parameter aw = 8;               //address width
6
parameter dw = 20;              //data width for internal control
7
parameter ow = 28;              //control output size
8
 
9
//dependant parameters (based on independant parameters
10
parameter cw = (1<<ncs)-1;              //number of conditional inputs (cw+1 must be a power of 2)
11
parameter pms = (1<<aw);        // program memory size. depends on address width ( pms = 2 ^ aw )
12
 
13
//  ow  + dw defines the width of one memory block of program memory
14
 
15
input [cw-1:0] cond;             // one conditional input is from down counter
16
input [0:0] clk, reset_n;
17
output [ow-1:0] out_sig;
18
 
19
//output of program memory
20
wire [aw-1:0] prog_ctr_a;                // program counte address
21
wire [aw-1:0] sub_a;             // subroutine address
22
wire [aw-1:0] branch_a;          // branch address
23
wire [ncs-1:0] cond_sel;
24
wire [3:0] nal_sel;
25
wire [0:0] pp;                            // push/pop_n
26
wire [0:0] cl;                            //count/load_n
27
wire [0:0] ce;                            //counter enable
28
wire [0:0] sse;                           // subroutine stack enable
29
wire [0:0] cse;                           // counter stack enable
30
 
31
wire [0:0] cc;                            // output of conditinal select mux
32
 
33
//output of NAL
34
wire [aw-1:0] next_inst_a;       //address of next instruction to execute
35
 
36
wire [aw:0]      dc;                             // down counter
37
wire [aw:0]      lc;                             // output of loop counter lifo
38
wire [aw:0]      cm;                             // output of counter mux
39
wire [aw:0]      ctr_o;                  // output of down counter register
40
 
41
wire [aw-1:0] inc_o;             // output of incrementer
42
 
43
// program memory
44
prog_mem mem (.addr(next_inst_a),.clk(clk),.dout({out_sig, nal_sel, cond_sel, cse, sse, ce, cl, pp, branch_a}));
45
 
46
nal                     #(.dw(aw)) next_addr(next_inst_a, ctr_o[aw-1:0], branch_a, sub_a, prog_ctr_a, cc, nal_sel[1:0], nal_sel[3:2], reset_n);
47
 
48
 
49
lifo            #(.dw(aw+1)) loop_cnt(ctr_o, lc, clk, cse, pp, reset_n);
50
mux2            #(.dw(aw+1)) counter_m(cm, {1'b0, branch_a}, lc, cl);
51
 
52
down_counter #(.dw(aw+1)) dn_ctr(cm, dc);
53
register_e #(.dw(aw+1)) ctr(dc, ctr_o, clk, reset_n, ce);
54
 
55
mux8            #(.dw(1))       cond_m(cc, ctr_o[aw], cond[0], cond[1], cond[2], cond[3], cond[4], cond[5], cond[6], cond_sel);
56
 
57
 
58
incrementer #(.dw(aw)) inc(next_inst_a, inc_o);
59
register #(.dw(aw)) prog_ctr(inc_o, prog_ctr_a, clk, reset_n);
60
 
61
lifo #(.dw(aw)) sub(prog_ctr_a, sub_a, clk, sse, pp, reset_n);
62
 
63
endmodule

powered by: WebSVN 2.1.0

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