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

Subversion Repositories natalius_8bit_risc

[/] [natalius_8bit_risc/] [trunk/] [processor_core/] [data_path.v] - Blame information for rev 5

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 5 fabioandre
`timescale 1ns / 1ps
2
//////////////////////////////////////////////////////////////////////////////////
3
// Company:       Universidad Pontificia Bolivariana
4
// Engineer:      Fabio Andres Guzman Figueroa
5
// 
6
// Create Date:    18:55:46 05/14/2012 
7
// Design Name: 
8
// Module Name:    data_path 
9
// Project Name: 
10
// Target Devices: 
11
// Tool versions: 
12
// Description: 
13
//
14
// Dependencies: 
15
//
16
// Revision: 
17
// Revision 0.01 - File Created
18
// Additional Comments: 
19
//
20
//////////////////////////////////////////////////////////////////////////////////
21
module data_path(
22
    input clk,
23
    input rst,
24
    input [7:0] data_in,
25
    input insel,
26
    input we,
27
    input [2:0] raa,
28
    input [2:0] rab,
29
    input [2:0] wa,
30
    input [2:0] opalu,
31
    input [2:0] sh,
32
    input selpc,
33
         input selk,
34
    input ldpc,
35
         input ldflag,
36
         input wr_en, rd_en,
37
         input [10:0] ninst_addr,
38
         input [7:0] kte,
39
         input [7:0] imm,
40
         input selimm,
41
    output [7:0] data_out,
42
    output [10:0] inst_addr,
43
         output [10:0] stack_addr,
44
         output reg z,c
45
    );
46
 
47
wire [7:0] regmux, muxkte, muximm;
48
wire [7:0] portA, portB;
49
wire [7:0] aluresu;
50
wire zero,carry;
51
wire [7:0] shiftout;
52
 
53
reg [10:0] PC;
54
wire [10:0] fifo_out;
55
 
56
regfile registros(regmux,clk,we,wa,raa,rab,portA,portB);
57
ALU alui(portA,muximm,aluresu,opalu,zero,carry);
58
shiftbyte shif_reg(aluresu,shiftout,sh);
59
LIFO LIFOi(clk,rst,wr_en,rd_en,PC,fifo_out);
60
 
61
assign stack_addr=fifo_out+1;
62
assign regmux=insel? shiftout : muxkte;
63
assign muxkte=selk? kte : data_in;
64
assign muximm=selimm? imm : portB;
65
 
66
always@(posedge clk or posedge rst)
67
        if (rst)
68
                begin
69
                        z<=0;
70
                        c<=0;
71
                end
72
        else
73
                if (ldflag)
74
                        begin
75
                                z<=zero;
76
                                c<=carry;
77
                        end
78
 
79
always@(posedge clk or posedge rst)
80
        if (rst)
81
                PC<=0;
82
        else
83
                if (ldpc)
84
                        if(selpc)
85
                                PC<=ninst_addr;
86
                        else
87
                                PC<=PC+1;
88
 
89
assign inst_addr=PC;
90
assign data_out=shiftout;
91
 
92
endmodule

powered by: WebSVN 2.1.0

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