Search This Blog

Thursday, 31 October 2013

Verilog Code for D-Latch

S.No:
Name
Direction
Width
Remark
1
D_in
IN
1
Input
2
Enb
IN
1
Synchronous Enable Input
3
Q
OUT
1
Output
4
Q_bar
OUT
1
Output

module d_latch(q, q_bar, d_in, enb);
   output q,q_bar;
   input  d_in;
   input  enb;

   nand g1 (s, d_in, enb),
   g2 (r, d_bar, enb);
   not g3 (d_bar,d_in);
   nand g4 (q, s, q_bar);
   nand g5 (q_bar, r, q);

endmodule

Verilog Code for 4-Bit Full Adder using 1-Bit Adder

Sr. No.
Name of the Pin
Direction
Width
Description
1
a
Input
4
Data Input
2
b
Input
4
Data Input
3
cin
inout
1
Input carry
4
Sum
Output
4
Summation
5
Cout
Output
1
Carry

Verilog Code for 1-bit Adder


module full_adder(sum,cout,a,b,cin);
   output sum;
   output cout;
   input  a,b,cin;
 
   assign{cout,sum}=a+b+cin;
endmodule

VHDL Code for Round Robin Arbiter with Fixed Time Slices

S.No.
Name
Direction
Width
Remark
1
Rst
Input
1
Reset signal
2
Clk
Input
1
Clock signal
3
Req
Input
4
Request for user1 ,user2,user3,user4
4
Gnt
Output
4
four grant signal to the Users

Round-robin (RR) is one of the simplest scheduling algorithms for processes in an operating system. As the term is generally used, time slices are assigned to each process in equal portions and in circular order, handling all processes without priority (also known as cyclic executive). Round-robin scheduling is simple, easy to implement, and starvation-free. Round-robin scheduling can also be applied to other scheduling problems, such as data packet scheduling in computer networks. Find out Round Robin Arbiter with variable time slice here.

VHDL Code for Fixed Priority Arbiter

S.No.
Name
Direction
Width
Remark
1
Rst
Input
1
Reset signal
2
Clk
Input
1
Clock signal
3
Req
Input
4
Request for user1 ,user2,user3,user4
4
Gnt
Output
4
four grant signal to the Users


The above design is a Priority Resolver circuit which gives priority to the requests of that user which was given grant the most earlier. In other way the user which was given grant most recently is given least priority. If the two requests have ,by chance, conflict in getting the grant, they will be issued the grant signal according to the following sequence:
req0     >          req1     >          req 3    >          req4