summaryrefslogtreecommitdiffstats
path: root/src/misc/mvc/mvcPrint.c
blob: b7ba494cb79312feb2b6ba0a6246500fbdb1e7ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
/**CFile****************************************************************

  FileName    [mvcPrint.c]

  PackageName [MVSIS 2.0: Multi-valued logic synthesis system.]

  Synopsis    [Printing cubes and covers.]

  Author      [MVSIS Group]
  
  Affiliation [UC Berkeley]

  Date        [Ver. 1.0. Started - February 1, 2003.]

  Revision    [$Id: mvcPrint.c,v 1.6 2003/04/09 18:02:06 alanmi Exp $]

***********************************************************************/

#include "mvc.h"
//#include "vm.h"
//#include "vmInt.h"

ABC_NAMESPACE_IMPL_START


////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

static void Mvc_CubePrintBinary( Mvc_Cover_t * pCover, Mvc_Cube_t * pCube );

////////////////////////////////////////////////////////////////////////
///                     FUNCTION DEFINITIONS                         ///
////////////////////////////////////////////////////////////////////////

/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CoverPrint( Mvc_Cover_t * pCover )
{
    Mvc_Cube_t * pCube;
    int i;
    // print general statistics
    printf( "The cover contains %d cubes (%d bits and %d words)\n", 
        pCover->lCubes.nItems, pCover->nBits, pCover->nWords );
    // iterate through the cubes
    Mvc_CoverForEachCube( pCover, pCube )
        Mvc_CubePrint( pCover, pCube );

    if ( pCover->pLits )
    {
        for ( i = 0; i < pCover->nBits; i++ )
            printf( " %d", pCover->pLits[i] );
        printf( "\n" ); 
    }
    printf( "End of cover printout\n" ); 
}


/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CubePrint( Mvc_Cover_t * pCover, Mvc_Cube_t * pCube )
{
    int iBit, Value;
    // iterate through the literals
//    printf( "Size = %2d   ", Mvc_CubeReadSize(pCube) );
    Mvc_CubeForEachBit( pCover, pCube, iBit, Value )
        printf( "%c", '0' + Value );
    printf( "\n" );
}


/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CoverPrintBinary( Mvc_Cover_t * pCover )
{
    Mvc_Cube_t * pCube;
    int i;
    // print general statistics
    printf( "The cover contains %d cubes (%d bits and %d words)\n", 
        pCover->lCubes.nItems, pCover->nBits, pCover->nWords );
    // iterate through the cubes
    Mvc_CoverForEachCube( pCover, pCube )
        Mvc_CubePrintBinary( pCover, pCube );

    if ( pCover->pLits )
    {
        for ( i = 0; i < pCover->nBits; i++ )
            printf( " %d", pCover->pLits[i] );
        printf( "\n" ); 
    }
    printf( "End of cover printout\n" ); 
}


/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CubePrintBinary( Mvc_Cover_t * pCover, Mvc_Cube_t * pCube )
{
    int iVar, Value;
    // iterate through the literals
//    printf( "Size = %2d   ", Mvc_CubeReadSize(pCube) );
    Mvc_CubeForEachVarValue( pCover, pCube, iVar, Value )
    {
        assert( Value != 0 );
        if ( Value == 3 )
            printf( "-" );
        else if ( Value == 1 )
            printf( "0" );
        else 
            printf( "1" );
    }
    printf( "\n" );
}

#if 0

/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CoverPrintMv( Mvc_Data_t * pData, Mvc_Cover_t * pCover )
{
    Mvc_Cube_t * pCube;
    int i;
    // print general statistics
    printf( "The cover contains %d cubes (%d bits and %d words)\n", 
        pCover->lCubes.nItems, pCover->nBits, pCover->nWords );
    // iterate through the cubes
    Mvc_CoverForEachCube( pCover, pCube )
        Mvc_CubePrintMv( pData, pCover, pCube );

    if ( pCover->pLits )
    {
        for ( i = 0; i < pCover->nBits; i++ )
            printf( " %d", pCover->pLits[i] );
        printf( "\n" ); 
    }
    printf( "End of cover printout\n" ); 
}


/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Mvc_CubePrintMv( Mvc_Data_t * pData, Mvc_Cover_t * pCover, Mvc_Cube_t * pCube )
{
    int iLit, iVar;
    // iterate through the literals
    printf( "Size = %2d   ", Mvc_CubeReadSize(pCube) );
    iVar = 0;
    for ( iLit = 0; iLit < pData->pVm->nValuesIn; iLit++ )
    {
        if ( iLit == pData->pVm->pValuesFirst[iVar+1] )
        {
            printf( " " );
            iVar++;
        }
        if ( Mvc_CubeBitValue( pCube, iLit ) )
            printf( "%c", '0' + iLit - pData->pVm->pValuesFirst[iVar] );
        else
            printf( "-" );
    }
    printf( "\n" );
}

#endif

////////////////////////////////////////////////////////////////////////
///                       END OF FILE                                ///
////////////////////////////////////////////////////////////////////////


ABC_NAMESPACE_IMPL_END
s="n">IA64_SPURIOUS_INT_VECTOR) { if (!IS_RESCHEDULE(vector)) { ia64_setreg(_IA64_REG_CR_TPR, vector); ia64_srlz_d(); __do_IRQ(local_vector_to_irq(vector), regs); /* * Disable interrupts and send EOI: */ local_irq_disable(); ia64_setreg(_IA64_REG_CR_TPR, saved_tpr); } ia64_eoi(); vector = ia64_get_ivr(); } /* * This must be done *after* the ia64_eoi(). For example, the keyboard softirq * handler needs to be able to wait for further keyboard interrupts, which can't * come through until ia64_eoi() has been done. */ irq_exit(); } #ifdef CONFIG_HOTPLUG_CPU /* * This function emulates a interrupt processing when a cpu is about to be * brought down. */ void ia64_process_pending_intr(void) { ia64_vector vector; unsigned long saved_tpr; extern unsigned int vectors_in_migration[NR_IRQS]; vector = ia64_get_ivr(); irq_enter(); saved_tpr = ia64_getreg(_IA64_REG_CR_TPR); ia64_srlz_d(); /* * Perform normal interrupt style processing */ while (vector != IA64_SPURIOUS_INT_VECTOR) { if (!IS_RESCHEDULE(vector)) { ia64_setreg(_IA64_REG_CR_TPR, vector); ia64_srlz_d(); /* * Now try calling normal ia64_handle_irq as it would have got called * from a real intr handler. Try passing null for pt_regs, hopefully * it will work. I hope it works!. * Probably could shared code. */ vectors_in_migration[local_vector_to_irq(vector)]=0; __do_IRQ(local_vector_to_irq(vector), NULL); /* * Disable interrupts and send EOI */ local_irq_disable(); ia64_setreg(_IA64_REG_CR_TPR, saved_tpr); } ia64_eoi(); vector = ia64_get_ivr(); } irq_exit(); } #endif #ifdef CONFIG_SMP extern irqreturn_t handle_IPI (int irq, void *dev_id, struct pt_regs *regs); static struct irqaction ipi_irqaction = { .handler = handle_IPI, #ifndef XEN .flags = SA_INTERRUPT, #endif .name = "IPI" }; #endif void register_percpu_irq (ia64_vector vec, struct irqaction *action) { irq_desc_t *desc; unsigned int irq; for (irq = 0; irq < NR_IRQS; ++irq) if (irq_to_vector(irq) == vec) { desc = irq_descp(irq); desc->status |= IRQ_PER_CPU; desc->handler = &irq_type_ia64_lsapic; if (action) setup_irq(irq, action); } } void __init init_IRQ (void) { register_percpu_irq(IA64_SPURIOUS_INT_VECTOR, NULL); #ifdef CONFIG_SMP register_percpu_irq(IA64_IPI_VECTOR, &ipi_irqaction); #endif #ifdef CONFIG_PERFMON pfm_init_percpu(); #endif platform_irq_init(); } void ia64_send_ipi (int cpu, int vector, int delivery_mode, int redirect) { void __iomem *ipi_addr; unsigned long ipi_data; unsigned long phys_cpu_id; #ifdef CONFIG_SMP phys_cpu_id = cpu_physical_id(cpu); #else phys_cpu_id = (ia64_getreg(_IA64_REG_CR_LID) >> 16) & 0xffff; #endif /* * cpu number is in 8bit ID and 8bit EID */ ipi_data = (delivery_mode << 8) | (vector & 0xff); ipi_addr = ipi_base_addr + ((phys_cpu_id << 4) | ((redirect & 1) << 3)); #ifdef XEN //printf ("send_ipi to %d (%x)\n", cpu, phys_cpu_id); #endif writeq(ipi_data, ipi_addr); }