/* The size of memory required to store an address depends on the system. Some computers might require special handling to hold a segment and offset under certain circumstances. The actual size required is not too important so long as we have a way of informing the compiler that what we want to store is an address. Such a variable is called a pointer variable.

1) To store a variable, we need to know how many bits/bytes would be required to hold the value.

2) To store address of a variable, we need not know the number of bits/bytes would be required to hold the address. It is machine dependent.

3) Type declaration for a pointer indicates what type of variable will be stored in that address.

*/

/* Pointers vs Arrays

// In C a string is an array of characters terminated with a binary zero character

(written as ).

char my_string[40];

my_string[0] = ‘T’;

my_string[1] = ‘e’;

my_string[2] = ‘d’:

my_string[3] = ‘‘;

// C permits

my_string[40] = “Ted”;

/* In the above example, my_string has 37 null characters in it, since the size of the array is 40 which is a constant. Here the lvalue is unmodifiable.

This can be avoided if a pointer is used instead. Here the lvalue is modifiable.

Create my first project at Github: This script can be downloaded from https://github.com/agraja/text2perl/blob/master/text2perl.pl #!/usr/bin/perl # Tiny preprocessor: # Example: Paste this example in a file # Pass it as argument to this script # some text /* for(1..5) { */ # this line will be printed 5 times # /* } */ open(P,”|$^X”); print P […]

Here is a preprocessor in perl, primarily for Verilog, SystemVerilog, but may be used for any language. There are programs with a lot of repetitive text. Language features like functions, objects can reduce typing. Still, there is scope for putting it in lesser code using a text preprocessor. Limitations in existing preprocessors prompted in writing a new on […]

Wire Can be used for input, output, inout Multiple drivers, No drivers cause x Usage: Wire variable = value; Assign variable = value; Can be used to connect module instances Reg Can be used only for input Can’t be used in ‘assign’ statement It takes last assigned value, behaves like a variable Note: R […]