Question

In: Computer Science

Write down the truth table fora 4-to-2 priority encoderhaving input W[3:0]and with priority levels in the...

Write down the truth table fora 4-to-2 priority encoderhaving input W[3:0]and with priority levels in the decreasing order (i.e., W[0]-Highest, ....., W[3]-Least). Write down the Verilog code for implementing   the same.

plz asap fast

Solutions

Expert Solution

4 : 2 Encoder

4-2 Encoder is a combinational circuit that encodes the information from 4 inputs to 2 bit output code (just reverse operation of Decoder).It has 4 input lines and 2 output lines. In our case the 4 to 2 Encoder consists of four inputs W3, W2, W1 and W0 and two outputs A1 & A0. Only one of these 4 inputs can be one at any time, to get the respective binary code at the output.

Truth table

Input

W3

W2

W1

W1

A1

A0

0

0

0

1

0

0

0

0

1

0

0

1

0

1

0

0

1

0

1

0

0

0

1

1

0

0

0

0

// we create our module with name encoder_4_to_2

//it contain two variables, input variable w[3:0] and output variable a[1:0]

module encoder_4_to_2(

    input [3:0] w,

    output [1:0] a

    );

reg [1:0]a;

always @ (w)

// start the execution

begin

if(w==4'b0001)

a=2'b00;

else if(w==4'b0010)

a=2'b01;

else if(w==4'b0100)

a=2'b10;

else if(w==4'b1000)

a=2'b11;

else

a=2'bzz;

end

//in the first case the if the last bit is 1; then the out put will be 00
//in the first case the if the last bit is 1; then the out put will be 00
//in the second case the if the second bit is 1; then the out put will be 10

//in the second case the if the second first bit is 1; then the out put will be 11

//other wise default value will be inserted in our case ,zz will be the output


Related Solutions

1. write a truth table using this symbol: --> 2. write the inputs for the truth...
1. write a truth table using this symbol: --> 2. write the inputs for the truth table to the left of the --> and write the outputs for the truth table to the right of the --> 3. write the compliment, or NOT using ' As an example: The truth table for AND is written this way: A B --> A AND B 0 0 --> 0 0 1 --> 0 1 0 --> 0 1 1 --> 1 or...
Use Python: Develop neurons and print truth table of the following 2-input logic gates: AND, OR,...
Use Python: Develop neurons and print truth table of the following 2-input logic gates: AND, OR, NAND, NOR, XOR, XNOR and 1-input NOT gate (Notice: use Markdown to explain how you developed a neuron, and to insert images showing the truth table of logic gates before coding)
Production costs Worker-hours (Input) Widgets (Output) 0 0 1 3 2   8 3 15 4 20...
Production costs Worker-hours (Input) Widgets (Output) 0 0 1 3 2   8 3 15 4 20 5 24 6 27 7 29 8 30 9 30 10 29 Fixed cost = $120 Variable cost = $15 a) Given the above widget production function information, graph the total product curve, clearly labeling everything. b) Given the cost information above, graph the total cost curve. Add columns to the table as needed. c) Describe the pattern of marginal returns and marginal costs....
Design a 8-to-3 binary encoder, with priority in binary sequence (i.e. input line 0 has higher...
Design a 8-to-3 binary encoder, with priority in binary sequence (i.e. input line 0 has higher priority than input line 1 etc). There should also be an "active" output which is 1 when any input line is active, and "0" when all input lines are 0. If all input lines are 0, the output lines other than the "active" output are "don't care".
Write a truth table for the proposition: ¬(q ∧ r) → (¬p ∨ ¬r). Consider a “1” to be true and a “0” to be false.
Write a truth table for the proposition: ¬(q ∧ r) → (¬p ∨ ¬r). Consider a “1” to be true and a “0” to be false.
Question 1: A Multiplexer (MUX) a) Write truth table and draw symbol for a 4-to-1 MUX....
Question 1: A Multiplexer (MUX) a) Write truth table and draw symbol for a 4-to-1 MUX. (1 mark) b) Write VHDL code for the above multiplexer. (1 mark) c) Write VHDL code for a test bench and simulate the design. (1 mark) d) Implement the design on FPGA, with inputs connected to switches and output to LED. (1 mark)
Give the VHDl code for your an 8-to-3 priority encoder using two 4-to-2 priority encoders and...
Give the VHDl code for your an 8-to-3 priority encoder using two 4-to-2 priority encoders and any additional necessary gates. Use port maps and code the structural behavior using logic gates not if else statements.
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6...
exampleInput.txt 1 2 3 0 2 3 4 0 1 3 5 0 1 2 6 1 5 6 8 2 4 6 7 3 4 5 9 10 5 8 9 4 7 9 6 7 8 6 How can I detect when 'cin' starts reading from a new line. The amount of numbers in each row is unknown. I need them in type 'int' to use the data.
Input Format 4 1 2 3 4 Constraints there will be no more than 50 input...
Input Format 4 1 2 3 4 Constraints there will be no more than 50 input numbers. Output Format Odd: 2 Even: 2 Divisible by 7: 0 Average: 250 Sample Input 0 4 1 2 3 4 Sample Output 0 Odd: 2 Even: 2 Divisible by 7: 0 Average: 250 import java.io.*; import java.math.*; import java.security.*; import java.text.*; import java.util.*; import java.util.concurrent.*; import java.util.regex.*; public class Solution {     public static void main(String[] args) throws IOException {         BufferedReader bufferedReader = new...
QUESTION 2 Suppose you are creating a truth table with 3 inputs (a, b, and c)...
QUESTION 2 Suppose you are creating a truth table with 3 inputs (a, b, and c) and 1 output (F). If an 'x' symbol indicates "don't care" (the value of the input does not effect the output), how many input combinations are covered by the single row of a truth table shown below? a b c F x 1 x 1 - 1 - 2 - 3 - 4 - None of the above QUESTION 3 Suppose you have a...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT