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

Subversion Repositories simple_customized_counter

[/] [simple_customized_counter/] [trunk/] [TestCounterOprEventBoard/] [src/] [CDecoder.psc] - Blame information for rev 48

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 lmorin12
component CDecoder (in  active  uint:4  iKeys,
2
                                    in  passive uint:10 iSwitches,
3
                                    out active  Opr_t   oOpr,
4
                                    out passive ubyte   oLoadValue)
5
{
6
    // This component decodes the Keys and the Switches input port as follow:
7
    //
8
    //      Switches bits 7-0 --> oLoadValue
9
    //
10
    //      Keys    An event on Keys generates an event on oOpr
11
    //              bit  0 --> Reset
12
    //              bit  1 --> Up
13
    //              bit  2 --> Down
14
    //              bit  3 --> Load
15
 
16
    enum KeyCmd_t { cKeyReset = 1, cKeyUp = 2, cKeyDown = 4, oKeyLoad = 8 };
17
 
18
    Decode(0) on iKeys
19
    {
20
        // Send the event
21
        oOpr:;
22
 
23
        // Decode the operation
24
        oOpr =  switch(iKeys)
25
                {
26
                    case cKeyReset: cOprReset;
27
                    case cKeyUp:    cOprUp;
28
                    case cKeyDown:  cOprDown;
29
                    case oKeyLoad:  cOprLoad;
30
                    default:        (uint:3)0;
31
                };
32
    }
33
 
34
    always()
35
    {
36
        oLoadValue = (ubyte)bits(iSwitches, 7ub, 0ub);
37
    }
38
};

powered by: WebSVN 2.1.0

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