Monday, 14 October 2013

CPU Design

-->


CPU design is the design engineering task of creating a central processing unit (CPU), a component of computer hardware. It is a subfield of electronics engineering and computer engineering.
CPU design focuses on these areas:
1.     datapaths (such as ALUs and pipelines)
2.     control unit: logic which controls the datapaths
3.     Memory components such as register files, caches
4.     Clock circuitry such as clock drivers, PLLsclock distribution networks
5.     Pad transceiver circuitry
6.     Logic gate cell library which is used to implement the logic
CPUs designed for high-performance markets might require custom designs for each of these items to achieve frequency, power-dissipation, and chip-area goals.
CPUs designed for lower performance markets might lessen the implementation burden by:
·         Acquiring some of these items by purchasing them as intellectual property
·         Use control logic implementation techniques (logic synthesis using CAD tools) to implement the other components - datapaths, register files, clocks
Common logic styles used in CPU design include:
·         Unstructured random logic
·         Finite-state machines
·         Microprogramming (common from 1965 to 1985)
·         Programmable logic array (common in the 1980s, no longer common)
Device types used to implement the logic include:
·         Transistor-transistor logic Small Scale Integration logic chips - no longer used for CPUs
·         Programmable Array Logic and Programmable logic devices - no longer used for CPUs
·         Emitter-coupled logic (ECL) gate arrays - no longer common
·         CMOS gate arrays - no longer used for CPUs
·         CMOS ASICs - what's commonly used today,[when?] they're so common that the term ASIC is not used for CPUs
·         Field-programmable gate arrays (FPGA) - common for soft microprocessors, and more or less required for reconfigurable computing
A CPU design project generally has these major tasks:
·         Programmer-visible instruction set architecture, which can be implemented by a variety of microarchitectures
·         Architectural study and performance modeling in ANSI C/C++ or SystemC[clarification needed]
·         High-level synthesis (HLS) or register transfer level (RTL, e.g. logic) implementation
·         RTL verification
·         Circuit design of speed critical components (caches, registers, ALUs)
·         Logic synthesis or logic-gate-level design
·         Timing analysis to confirm that all logic and circuits will run at the specified operating frequency
·         Physical design including floor planningplace and route of logic gates
·         Checking that RTL, gate-level, transistor-level and physical-level representations are equivalent
·         Checks for signal integritychip manufacturability
Re-designing a CPU core to a smaller die-area helps achieve several of these goals.
·         Shrinking everything (a "photomask shrink"), resulting in the same number of transistors on a smaller die, improves performance (smaller transistors switch faster), reduces power (smaller wires have less parasitic capacitance) and reduces cost (more CPUs fit on the same wafer of silicon).
·         Releasing a CPU on the same size die, but with a smaller CPU core, keeps the cost about the same but allows higher levels of integration within one VLSI chip (additional cache, multiple CPUs, or other components), improving performance and reducing overall system cost.
As with most complex electronic designs, the logic verification effort (proving that the design does not have bugs) now dominates the project schedule of a CPU.
Key CPU architectural innovations include index registercachevirtual memoryinstruction pipeliningsuperscalarCISCRISCvirtual machineemulatorsmicroprogram, andstack.

Thursday, 16 May 2013

SMS Gateway Intergration in .net



-->


using System.Text;

using System.Net;

using System.IO;

///


/// Summary description for sendsms

///


///



public class sendsms

{





public static void Main(string[] args)

{

string result = "";

WebRequest request = null;

HttpWebResponse response = null;

try

{

String sendToPhoneNumber = "xxxxxxxxx";

String userid = "xxxxx";

String passwd = "xxxxx";

String url = "http://enterprise.smsgupshup.com/GatewayAPI/rest?method=sendMessage&send_to=" + sendToPhoneNumber + "&msg=hello&userid=" + userid + "&password=" + passwd + "&v=1.1" & msg_type = TEXT & auth_scheme = PLAIN;

request = WebRequest.Create(url);

//in case u work behind proxy, uncomment the/*WebProxy proxy = new WebProxy("http://proxy:80/",true);

//proxy.Credentials = new NetworkCredential("userId","password", "Domain");

//request.Proxy = proxy;

/// Send the 'HttpWebRequest' and wait for response.response = (HttpWebResponse)request.GetResponse();

Stream stream = response.GetResponseStream();

Encoding ec = System.Text.Encoding.GetEncoding("utf-8");

StreamReader reader = new System.IO.StreamReader(stream, ec);

result = reader.ReadToEnd();

Console.WriteLine(result);

reader.Close();

stream.Close();

}

catch (Exception exp)

{

Console.WriteLine(exp.ToString());

}

finally

{

if (response != null) response.Close();

}

}



}






Monday, 18 March 2013

SEND SMS


Introduction:
This article describes a simple way to send text messages to a cellular phone from within a C# desktop application.  The source code provided includes a relatively good list of carriers to simplify the task of connecting with a cell phone and the task itself is really no more difficult than sending an email message through a desktop or web based application.
Getting Started:
In order to begin, unzip the downloaded files and open the project provided.  Within the project you will find one main class:  frmMain.cs.  The main form is a windows application form and it contains a few controls necessary to capture the fields needed to properly form the message.  These fields include:
  • Recipient's Phone Number:  Captures the recipient's cellular telephone number (10 digit)
  • Recipient's Carrier:  Captures the recipient's carrier.
  • Sender's email address:  Captures the sender's email address.
  • Sender's email server:  Captures the name of the sender's email server 
  • Message Subject Line:  Captures the message's title or subject
  • Message Body:  Captures the sender's message content.
The application is simple but could easily be improved by validating each of the required fields through the use of regular expressions or by at least validating that the text associated with each of the text boxes is not an empty string.  To maintain the simplicity of the project, little in the way of error handling has been included.
The following figure (Figure 1) shows a properly configured collection of input fields in use:

Figure 1: The Demonstration Application in Use
A quick review of the code will reveal that there is little going on there.  The following imports were added to the top of the class:
using System;
using System.Net.Mail;
The System.Net.Mail import brings in the support necessary to transmit the messages generated using the application.  Following the imports and the class declaration, there is a declarations region identified and within that region is a collection of private member variables; these private member variables are created in order to supply each of the required elements of the message.
#Region "Declarations"

// message elements
   private string mMailServer;
   private string mTo;
   private string mFrom;
   private string mMsg;
   private string mSubject;
 
#End Region
At this point, the only thing left to do in code is to  write the following  three methods:
   
private void frmMain_Load(System.Object sender, System.EventArgs e)
     {
        // set up the carriers list - this is a fair list, you may wish to
        // research the topic and add others, it took a while to generate this
        // list...
        cboCarrier.Items.Add("@itelemigcelular.com.br");
        cboCarrier.Items.Add("@message.alltel.com");
        cboCarrier.Items.Add("@message.pioneerenidcellular.com");
        cboCarrier.Items.Add("@messaging.cellone-sf.com");
        cboCarrier.Items.Add("@messaging.centurytel.net");
        cboCarrier.Items.Add("@messaging.sprintpcs.com");
        cboCarrier.Items.Add("@mobile.att.net");
        cboCarrier.Items.Add("@mobile.cell1se.com");
        cboCarrier.Items.Add("@mobile.celloneusa.com");
        cboCarrier.Items.Add("@mobile.dobson.net");
        cboCarrier.Items.Add("@mobile.mycingular.com");
        cboCarrier.Items.Add("@mobile.mycingular.net");
        cboCarrier.Items.Add("@mobile.surewest.com");
        cboCarrier.Items.Add("@msg.acsalaska.com");
        cboCarrier.Items.Add("@msg.clearnet.com");
        cboCarrier.Items.Add("@msg.mactel.com");
        cboCarrier.Items.Add("@msg.myvzw.com");
        cboCarrier.Items.Add("@msg.telus.com");
        cboCarrier.Items.Add("@mycellular.com");
        cboCarrier.Items.Add("@mycingular.com");
        cboCarrier.Items.Add("@mycingular.net");
        cboCarrier.Items.Add("@mycingular.textmsg.com");
        cboCarrier.Items.Add("@o2.net.br");
        cboCarrier.Items.Add("@ondefor.com");
        cboCarrier.Items.Add("@pcs.rogers.com");
        cboCarrier.Items.Add("@personal-net.com.ar");
        cboCarrier.Items.Add("@personal.net.py");
        cboCarrier.Items.Add("@portafree.com");
        cboCarrier.Items.Add("@qwest.com");
        cboCarrier.Items.Add("@qwestmp.com");
        cboCarrier.Items.Add("@sbcemail.com");
        cboCarrier.Items.Add("@sms.bluecell.com");
        cboCarrier.Items.Add("@sms.cwjamaica.com");
        cboCarrier.Items.Add("@sms.edgewireless.com");
        cboCarrier.Items.Add("@sms.hickorytech.com");
        cboCarrier.Items.Add("@sms.net.nz");
        cboCarrier.Items.Add("@sms.pscel.com");
        cboCarrier.Items.Add("@smsc.vzpacifica.net");
        cboCarrier.Items.Add("@speedmemo.com");
        cboCarrier.Items.Add("@suncom1.com");
        cboCarrier.Items.Add("@sungram.com");
        cboCarrier.Items.Add("@telesurf.com.py");
        cboCarrier.Items.Add("@teletexto.rcp.net.pe");
        cboCarrier.Items.Add("@text.houstoncellular.net");
        cboCarrier.Items.Add("@text.telus.com");
        cboCarrier.Items.Add("@timnet.com");
        cboCarrier.Items.Add("@timnet.com.br");
        cboCarrier.Items.Add("@tms.suncom.com");
        cboCarrier.Items.Add("@tmomail.net");
        cboCarrier.Items.Add("@tsttmobile.co.tt");
        cboCarrier.Items.Add("@txt.bellmobility.ca");
        cboCarrier.Items.Add("@typetalk.ruralcellular.com");
        cboCarrier.Items.Add("@unistar.unifon.com.ar");
        cboCarrier.Items.Add("@uscc.textmsg.com");
        cboCarrier.Items.Add("@voicestream.net");
        cboCarrier.Items.Add("@vtext.com");
        cboCarrier.Items.Add("@wireless.bellsouth.com");
   }
   private void btnSend_Click(System.Object sender, System.EventArgs e)
   {
     // Collect user input from the form and stow content into
     // the objects member variables
        mTo = Trim(txtPhoneNumber.Text) & Trim(cboCarrier.SelectedItem.ToString());
        mFrom = Trim(txtSender.Text);
        mSubject = Trim(txtSubject.Text);
        mMailServer = Trim(txtMailServer.Text);
        mMsg = Trim(txtMessage.Text);
     // Within a try catch, format and send the message to
     // the recipient.  Catch and handle any errors.
         try
           {
            MailMessage message= new MailMessage(mFrom, mTo, mSubject, mMsg);
            SmtpClient mySmtpClient=new SmtpClient(mMailServer);
            mySmtpClient.UseDefaultCredentials = True;
            mySmtpClient.Send(message);
            MessageBox.Show("The mail message has been sent to " & message.To.ToString(), "Mail", MessageBoxButtons.OK, MessageBoxIcon.Information);
           }
         catch(FormatException ex)
           {
            MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
         catch(SmtpException ex)
           {
            MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
        catch(Exception ex)
           {
            MessageBox.Show(ex.StackTrace, ex.Message, MessageBoxButtons.OK, MessageBoxIcon.Error);
           }
        }
        private void btnExit_Click(System.Object sender, System.EventArgs e)
          { 
          // Upon user's request, close the application
             Application.Exit();
          }

At this point, the application should be complete you may wish to build the solution and test it.  Even though this example was intended to be simple, the overall concept may be used within an application to do some seemingly complex jobs.  For example, if you were tasked with writing an application that monitored some sort of trend information such as a daily stock price, and were to alert a group of end users whenever the stock price exceeded some predetermined, agreed upon value, you could do something such as looping through a collection of users subscribing to the stock price monitoring service and direct a text message to each of these users indicating that the watched stock had surpassed the threshold value. 
Also please note that, whilst it does cost you a dime to send a message to a cell phone in this manner, it may well cost the recipient something to receive it.  Bearing that in mind, as you test your version of the code, be mindful of an expenses you may be generating for yourself (if, for example, you are sending messages to yourself) or another person.