[go: up one dir, main page]

0% found this document useful (0 votes)
154 views3 pages

Tutorial Sheet 1

The document provides 9 tutorials for building basic digital logic circuits using Verilog. Tutorial 1 describes building a circuit to replicate a 3-bit input vector to 3 separate 1-bit outputs. Tutorial 2 splits a 16-bit input into two 8-bit bytes. Tutorial 3 concatenates 6 5-bit inputs into 4 8-bit outputs. Tutorial 4 reverses the bit order of an 8-bit input. Tutorial 5 sign-extends an 8-bit number to 32 bits.

Uploaded by

vipako9305
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
154 views3 pages

Tutorial Sheet 1

The document provides 9 tutorials for building basic digital logic circuits using Verilog. Tutorial 1 describes building a circuit to replicate a 3-bit input vector to 3 separate 1-bit outputs. Tutorial 2 splits a 16-bit input into two 8-bit bytes. Tutorial 3 concatenates 6 5-bit inputs into 4 8-bit outputs. Tutorial 4 reverses the bit order of an 8-bit input. Tutorial 5 sign-extends an 8-bit number to 32 bits.

Uploaded by

vipako9305
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Tutorial Sheet 1

BECE 0209- (Digital Design using Verilog)


1. Build a circuit that has one 3-bit input, then outputs the same vector, and also splits it
into three separate 1-bit outputs. Connect output o0 to the input vector's position
0, o1 to position 1, etc.In a diagram, a tick mark with a number next to it indicates the
width of the vector (or "bus"), rather than drawing a separate line for each bit in the
vector.

2. Build a combinational circuit that splits an input half-word (16 bits, [15:0] ) into lower [7:0]
and upper [15:8] bytes.

3. Given several input vectors, concatenate them together then split them up into several output
vectors. There are six 5-bit input vectors: a, b, c, d, e, and f, for a total of 30 bits of input. There are
four 8-bit output vectors: w, x, y, and z, for 32 bits of output. The output should be a concatenation
of the input vectors followed by two 1 bits:

4. Given an 8-bit input vector [7:0], reverse its bit ordering.

5. Build a circuit that sign-extends an 8-bit number to 32 bits. This requires a


concatenation of 24 copies of the sign bit (i.e., replicate bit[7] 24 times) followed by
the 8-bit number itself.
6. Given five 1-bit signals (a, b, c, d, and e), compute all 25 pairwise one-bit comparisons
in the 25-bit output vector. The output should be 1 if the two bits being compared are
equal.
out[24] = ~a ^ a; // a == a, so out[24] is always 1.
out[23] = ~a ^ b;
out[22] = ~a ^ c;
...
out[ 1] = ~e ^ d;
out[ 0] = ~e ^ e;

7. You are given a module my_dff with two inputs and one output (that implements a D
flip-flop). Instantiate three of them, then chain them together to make a shift register of
length 3. The clk port needs to be connected to all instances.
The module provided to you is: module my_dff ( input clk, input d, output q );
Note that to make the internal connections, you will need to declare some wires. Be
careful about naming your wires and module instances: the names must be unique.

8. The module provided to you is: module my_dff8 ( input clk, input [7:0] d, output [7:0] q );
The multiplexer is not provided. One possible way to write one is inside an always block with
a case statement inside.
9. Connect the modules together as shown in the diagram below. The provided module add16 has the
following declaration:
module add16 ( input[15:0] a, input[15:0] b, input cin, output[15:0] sum, output cout );

You might also like