Skip to main content


Showing posts from April, 2017

Verilog Code for I2C Protocol

I2C devices have been around us for a long time. If you have done any arduino projects with any peripherals such as Bluetooh (HC-05) or Gyroscope (MPU6050) or Barometer etc you might be surprised you have already used I2C devices. Yes
An I2C basically consists of a master microcontroller and a slave device which responds to the requests of the master. A slave cannot operate on its own. It can't even communicate with other slaves without having any permission from the master.
      You may have come across multi-master schematic but it becomes much more complex to handle such situation because of data leakage and also it requires more than 1 microcontrollers. So if you are using an I2C you cannot use any other non-I2C device on the same bus as both SDA and SCL lines are in conjunction with the I2C module. If you find this facility somewhere you are being fooled seriously !!!  I2C works on 2 signals as SCL and…

Verilog Code for Sequence Detector

SEQUENCE DETECTOR Hola Amigos Beginning with the simple theory about Sequence Detector. A sequence detector an algorithm which detects a sequence within a given set of bits. Of course the length of total bits must be greater than sequence that has to be detected. Sequence detector basically is of two types –

a.Overlapping b.Non Overlapping In overlapping some of the last bits can also be used for the start of detection of next sequence within the given bits.

For Example Let the sequence be 11011 and given bits 1101101101101101 Now lets work on overlapping concept. We have 5 bits here in 11011 hence we will have 5 states. Let em be A/B/C/D and E. Initially pstate will be A. Now
1.Incoming bit is 1 (from 1101101101101101) and it matches with first bit of sequence hence jump to next B. Requirement(1011) 2.Incoming bit is 1 (from 1101101101101101)and it matches with  first bit of requirement hence jump to state C. Requirement (011) 3.Incoming bit is 0 (from 1101101101101101) and it matches with fir…