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

Subversion Repositories microriscii

[/] [microriscii/] [trunk/] [verilog/] [rtl/] [au.v] - Diff between revs 8 and 11

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 8 Rev 11
Line 25... Line 25...
`define         ALU_PCNT        4'b1100
`define         ALU_PCNT        4'b1100
`define         ALU_PCNTZ       4'b1101
`define         ALU_PCNTZ       4'b1101
`define         ALU_PCNTC       4'b1110
`define         ALU_PCNTC       4'b1110
`define         ALU_RND         4'b1111
`define         ALU_RND         4'b1111
 
 
module au(a,b,clk,arith_op,carry,o,rndin);
module au(a,b,arith_op,carry,o,rndin);
        // Inputs
        // Inputs
        input   [31:0]   a;
        input   [31:0]   a;
        wire    [31:0]   a;
        wire    [31:0]   a;
        input   [31:0]   b;
        input   [31:0]   b;
        wire    [31:0]   b;
        wire    [31:0]   b;
        input                   clk;
 
        wire                    clk;
 
        input   [3:0]    arith_op;
        input   [3:0]    arith_op;
        wire    [3:0]    arith_op;
        wire    [3:0]    arith_op;
        input   [31:0]   rndin;
        input   [31:0]   rndin;
        wire    [31:0]   rndin;
        wire    [31:0]   rndin;
        // Outputs
        // Outputs
Line 89... Line 87...
                        a_chg[2] = a[3] ^^ a[2];
                        a_chg[2] = a[3] ^^ a[2];
                        a_chg[1] = a[2] ^^ a[1];
                        a_chg[1] = a[2] ^^ a[1];
                        a_chg[0] = a[1] ^^ a[0];
                        a_chg[0] = a[1] ^^ a[0];
                end
                end
 
 
// TODO
        // TODO: Random Number Generator
//      always @ (posedge clk)
 
//              rnd = rndin;
 
 
 
        always @ (arith_op || a || b) // Main Operation
        always @ (arith_op || a || b) // Main Operation
                case (arith_op)
                case (arith_op)
                        `ALU_ADD : // Add
                        `ALU_ADD : // Add
                                o = a + b;
                                o = a + b;
Line 145... Line 141...
                                pcntc1 = PopCntO4(a_chg[15:12]) + PopCntO4(a_chg[11:8]) + PopCntO4(a_chg[7:4]) + PopCntO4(a_chg[3:0]);
                                pcntc1 = PopCntO4(a_chg[15:12]) + PopCntO4(a_chg[11:8]) + PopCntO4(a_chg[7:4]) + PopCntO4(a_chg[3:0]);
                                o = pcntc0 + pcntc1;
                                o = pcntc0 + pcntc1;
                        end
                        end
                        `ALU_RND : // Random
                        `ALU_RND : // Random
                                o = rnd;
                                o = rnd;
                        default : // BAD NEWS
 
                                o = 8'h4655434B; // Random data for have fun ;)
 
                endcase
                endcase
 
 
        function [5:0] PopCntO4; // One Count
        function [5:0] PopCntO4; // One Count
        input [3:0] x;
        input [3:0] x;
                begin
                begin

powered by: WebSVN 2.1.0

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