Wednesday, November 30, 2011

C Program to find endianness ...


#include stdio.h

typedef union s{
int i;
char c[4];
} Utype;

int main()
{
Utype u;
char c;
u.i = 0x12345678;
printf(" %p - 0x%X\n", &u.i, u.i);
printf(" %p - 0x%X\n", &u.c[0], u.c[0]);
printf(" %p - 0x%X\n", &u.c[1], u.c[1]);
printf(" %p - 0x%X\n", &u.c[2], u.c[2]);
printf(" %p - 0x%X\n", &u.c[3], u.c[3]);

c = (u.i & 0x00000078);

if(c == u.c[0])
printf("\n***LITTLE ENDIEN***\n");
else
printf("\n***BIG ENDIEN***\n");
}

Friday, November 11, 2011

Python Digital Circuit Simulator

             If anyone is looking for the digital circuit simulator in python can refer to my project on google code hosting Pydlcs. It provides basic digital elements like AND, OR gates, some combinational  elements (e.g. half/full adder, mux/demux) and sequential elements (e.g. D-flipflop). You can create and simulate any digital circuit using this basic elements in this simulator.


HAVE FUN  :)