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

Subversion Repositories systemc_rng

[/] [systemc_rng/] [trunk/] [rtl/] [systemc/] [rng.cpp] - Diff between revs 2 and 6

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

Rev 2 Rev 6
Line 44... Line 44...
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//
//
// CVS Revision History
// CVS Revision History
//
//
// $Log: not supported by cvs2svn $
// $Log: not supported by cvs2svn $
 
// Revision 1.1.1.1  2004/08/19 14:27:14  jcastillo
 
// First import
 
//
 
 
#include "rng.h"
#include "rng.h"
 
 
void rng::combinate(){
void
        if(!reset.read()){
rng::combinate ()
 
{
 
  if (!reset.read ())
 
    {
                number_o.write(0);
                number_o.write(0);
        }else{
    }
           number_o.write(LFSR_reg.read().range(31,0)^CASR_reg.read().range(31,0));
  else
 
    {
 
      number_o.write (LFSR_reg.read ().range (31, 0) ^ CASR_reg.read ().
 
                      range (31, 0));
        }
        }
}
}
 
 
void rng::LFSR(){
void
 
rng::LFSR ()
 
{
 
 
        sc_uint<43> LFSR_var;
        sc_uint<43> LFSR_var;
        bool outbit;
        bool outbit;
 
 
        if(!reset.read()){
  if (!reset.read ())
 
    {
                LFSR_reg.write(1);
                LFSR_reg.write(1);
        }else{
    }
                if(loadseed_i.read()){
  else
 
    {
 
      if (loadseed_i.read ())
 
        {
                        LFSR_var.range(42,31)=0;
                        LFSR_var.range(42,31)=0;
                        LFSR_var.range(31,0)=seed_i.read();
                        LFSR_var.range(31,0)=seed_i.read();
                        LFSR_reg.write(LFSR_var);
                        LFSR_reg.write(LFSR_var);
 
 
                }else{
        }
 
      else
 
        {
                  LFSR_var=LFSR_reg.read();
                  LFSR_var=LFSR_reg.read();
 
 
                  outbit=LFSR_var[42];
                  outbit=LFSR_var[42];
                  LFSR_var[42]=LFSR_var[41];
                  LFSR_var[42]=LFSR_var[41];
                  LFSR_var[41]=LFSR_var[40]^outbit;
                  LFSR_var[41]=LFSR_var[40]^outbit;
Line 121... Line 138...
          LFSR_reg.write(LFSR_var);
          LFSR_reg.write(LFSR_var);
          }
          }
  }
  }
}
}
 
 
void rng::CASR(){
void
 
rng::CASR ()
 
{
 
 
        sc_uint<43> CASR_var,CASR_out;
        sc_uint<43> CASR_var,CASR_out;
 
 
        if(!reset.read()){
  if (!reset.read ())
 
    {
                CASR_reg.write(1);
                CASR_reg.write(1);
        }else{
    }
                if(loadseed_i.read()){
  else
 
    {
 
      if (loadseed_i.read ())
 
        {
                        CASR_var.range(36,31)=0;
                        CASR_var.range(36,31)=0;
                        CASR_var.range(31,0)=seed_i.read();
                        CASR_var.range(31,0)=seed_i.read();
                        CASR_reg.write(CASR_var);
                        CASR_reg.write(CASR_var);
 
 
                }else{
        }
 
      else
 
        {
                  CASR_var=CASR_reg.read();
                  CASR_var=CASR_reg.read();
 
 
                  CASR_out[36]=CASR_var[35]^CASR_var[0] ;
                  CASR_out[36]=CASR_var[35]^CASR_var[0] ;
                  CASR_out[35]=CASR_var[34]^CASR_var[36] ;
                  CASR_out[35]=CASR_var[34]^CASR_var[36] ;
                  CASR_out[34]=CASR_var[33]^CASR_var[35] ;
                  CASR_out[34]=CASR_var[33]^CASR_var[35] ;

powered by: WebSVN 2.1.0

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