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

Subversion Repositories simple_customized_counter

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 7 to Rev 8
    Reverse comparison

Rev 7 → Rev 8

/simple_customized_counter/trunk/src/main.vmc Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/simple_customized_counter/trunk/src/main.vms Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/simple_customized_counter/trunk/Counter.rpj Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream
/simple_customized_counter/trunk/CounterLib.psC
15,17 → 15,23
// -- oValue := 0
//
// There are four counters in the library:
// - CCounterEvent: executes the operation on separate input events
// - CCounterLevel: executes the operation at each step based
// - CCounterEvent: executes the operation on separate input events
// - CCounterLevel: executes the operation at each step based
// - CCounterOprEvent: executes the operation on input Opr event
// - CCounterOprLevel: executes the operation at each step
// the operation is encoded on the input iOpr
// the operation is encoded on the input iOpr
// TESTING:
// - CCounterEvent: manual test with control panel
// - CCounterLevel: using waveform editor and viewer
// - CCounterOprLevel: using waveform editor and viewer
// - CCounterOprEvent: simulated and real DE1SoC board
// controlled by a C++ program
component CCounterEvent (in active bit iReset,
in active bit iUp,
in active bit iDown,
in active bit iLoad,
in passive ubyte iLoadVal,
in passive ubyte iLoadValue,
out active ubyte oValue)
{
// This counter executes the operation on input events
50,7 → 56,7
 
LoadValue(3) on iLoad
{
oValue := iLoadVal;
oValue := iLoadValue;
}
};
83,17 → 89,14
 
else if(iLoad)
{
oValue := iLoadVal;
oValue := iLoadValue;
}
}
};
 
typedef Opr_t { cOprReset, cOprUp, cOprDown, cOprLoad };
enum Opr_t { cOprReset, cOprUp, cOprDown, cOprLoad };
 
component CCounterOprEvent (in active bit iReset,
in active bit iUp,
in active bit iDown,
in active bit iLoad,
component CCounterOprEvent (in active Opr_t iOpr,
in active ubyte iLoadValue,
out active ubyte oValue)
{
107,10 → 110,10
{
switch(iOpr)
{
case iReset: Value := 0ub;
case iUp: oValue:++;
case iDown: oValue:--;
case iLoad: oValue := iLoadValue;
case cOprReset: oValue:= 0ub;
case cOprUp: oValue:++;
case cOprDown: oValue:--;
case cOprLoad: oValue := iLoadValue;
}
}
 
117,12 → 120,9
 
};
component CCounterLevel (in active bit iReset,
in active bit iUp,
in active bit iDown,
in active bit iLoad,
in active ubyte iLoadValue,
out active ubyte oValue)
component CCounterOprLevel (in active Opr_t iOpr,
in active ubyte iLoadValue,
out active ubyte oValue)
{
// This counter executes the operation at each steo or clock pulse
// The priority is implemented with if and else instructions
135,12 → 135,12
// The switch instruction returns a value
oValue = switch(iOpr)
{
case iReset: 0ub;
case iUp: oValue + 1ub;
case iDown: oValue - 1ub;
case iLoad: iLoadValue;
}
case cOprReset: 0ub;
case cOprUp: oValue + 1ub;
case cOprDown: oValue - 1ub;
case cOprLoad: iLoadValue;
};
}
};
 
}
};

powered by: WebSVN 2.1.0

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