#### muhamadamru

##### Newbie level 2

Our prof gives us this homework which is much advanced than what we learn and we have to do it , i don't know how to make a counter without using clk "sequntial circuits ", but he asked us to use just combinational circuits , this is what he needs :

// Circuit description:

The blackblock32 circuit counts the number of "black" blocks inside a given vector. A block of contiguous bits is "black" if it has at least two bits, all bits are logic 1, and its neigbours are logic 0 bits. If a "black" block touches the right edge of the vector, its right neigbour is supposed to be a logic 0 bit. The input vector is 32 bits wide. The output of the circuit is the number of "black" blocks. The circuit's interface comprises the 32 bit data input (vector), one additional 1 bit input used for the extension to the left (the left neigbour of the vector's MSB), and a 4 bit output. Example 1

inputs: 0 00001111000000111111000001111110 outputs: 0011 3 "black" blocks

A (6 points) Design in Verilog the combinational logic circuit that implements the blackblock32 function. The interface of the blackblock32 module is given in the table below: name bits meaning din 32 data vector left 1 extension bit from the left nr_black 4 number of "black" blocks

B (4 points) Design in Verilog the combinational circuit blackblock128 that implements the same function for a 128-bit vector, using multiple instances of functional blocks of blackblock32 type, and a subblock that processes only the outputs of the blackblock32 subblocks. The LSB from each 32-bit subvector is the extension bit used for processing the 32-bit subvector to its right. This way, any "black" block that extends beyond the border of a subvector is counted only once. The maximum number of "black" blocks inside a 128-bit vector is 43. The interface of blackblock32 module is given below: name bits meaning din 128 data vector left 1 extension bit from the left nr_black 6 number of "black" blocks

Thanks in advance .