2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2.

Slides:



Advertisements
Similar presentations
Digital Logic with VHDL EE 230 Digital Systems Fall 2006 (10/17/2006)
Advertisements

1 Lecture 13 VHDL 3/16/09. 2 VHDL VHDL is a hardware description language. The behavior of a digital system can be described (specified) by writing a.
Quad 2-to-1 and Quad 4-to-1 Multiplexers Discussion D2.4 Example 7.
Arbitrary Waveform Discussion 5.5 Example 34.
Decoders Discussion D9.5 Example 25. Decoders 3-to-8 Decoder decoder38.vhd library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_unsigned.all;
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
Shifters Discussion D7.1 Example Bit Shifter.
Divider Discussion D7.3 Example 20.
Ring Counter Discussion D5.3 Example 32. Ring Counter if rising_edge(CLK) then for i in 0 to 2 loop s(i)
Adder Discussion D6.2 Example 17. s i = c i ^ (a i ^ b i ) c i+1 = a i * b i + c i * (a i ^ b i ) Full Adder (Appendix I)
Generic Multiplexers: Parameters Discussion D2.5 Example 8.
Decoders and Encoders Lecture L4.2. Decoders and Encoders Binary Decoders Binary Encoders Priority Encoders.
Introduction to VHDL VHDL Tutorial R. E. Haskell and D. M. Hanna T1: Combinational Logic Circuits.
Single-Cycle Instructions VHDL Tutorial R. E. Haskell and D. M. Hanna T5: VHDL ROM.
1 Comparators Discussion D A 1-Bit Comparator The variable Gout is 1 if x > y or if x = y and Gin = 1. The variable Eout is 1 if x = y and Gin =
FPGAs and VHDL Lecture L12.1. FPGAs and VHDL Field Programmable Gate Arrays (FPGAs) VHDL –2 x 1 MUX –4 x 1 MUX –An Adder –Binary-to-BCD Converter –A Register.
Counters Discussion D5.3 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
Lab 2 4-Bit Adder Digilent Spartan 3 Board Lecture L2.3.
4-to-1 Multiplexer: case Statement Discussion D2.3 Example 6.
Digilent Spartan 3 Board Discussion D3.3
7-Segment Displays Digilent Spartan 3 Board Discussion DS-4.2.
Introduction to VHDL Multiplexers Discussion D1.1.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448.
Binary-to-BCD Converter
Binary-to-BCD Converter
4-Bit Binary-to-BCD Converter: case Statement
Shift Registers Discussion D5.2 Example Bit Shift Register qs(3) qs(2) qs(1) qs(0) if rising_edge(CLK) then for i in 0 to 2 loop s(i) := s(i+1);
1 Comparators: Procedures Discussion D9.2 Example 22.
CSET 4650 Field Programmable Logic Devices Dan Solarek VHDL Behavioral & Structural.
AND Gate: A Logic circuit whose output is logic ‘1’ if and only if all of its inputs are logic ‘1’.
4-bit Shift Register. 2-bit Register Serial-in-serial-out Shift Register.
Binary-to-BCD Converter
A.7 Concurrent Assignment Statements Used to assign a value to a signal in an architecture body. Four types of concurrent assignment statements –Simple.
Figure 5.1 Conversion from decimal to binary. Table 5.1 Numbers in different systems.
1 Combinational Logic Lecture #6. 모바일컴퓨터특강 2 강의순서 Decoder 3x8 Mux 4x1 Mux 8x1 Mux 8x1 4bits Half Adder Full Adder Ripple carry Adder 4-bit Adder.
1 Part I: SYSTEM DESIGN. 2 Packages and Components Functions and Procedures Problem (Design & Implementation) Additional System Designs.
VHDL for Combinational Circuits. VHDL We Know Simple assignment statements –f
ECE 331 – Digital System Design Multiplexers and Demultiplexers (Lecture #13)
4-to-1 Multiplexer: Module Instantiation Discussion D2.2 Example 5.
2/10/07DSD,USIT,GGSIPU1 BCD adder KB3B2B1B0CD3D2D1D
Digital System Projects
ECE 331 – Digital System Design Multi-bit Adder Circuits, Adder/Subtractor Circuit, and Multiplier Circuit (Lecture #12)
 Seattle Pacific University EE Logic System DesignCounters-1 Shift Registers DQ clk DQ DQ ShiftIn Q3Q3 Q2Q2 DQ Q1Q1 Q0Q0 A shift register shifts.
9/9/2006DSD,USIT,GGSIPU1 Concurrent vs Sequential Combinational vs Sequential logic –Combinational logic is that in which the output of the circuit depends.
CS/EE 3700 : Fundamentals of Digital System Design
VHDL ELEC 311 Digital Logic and Circuits Dr. Ron Hayne Images Courtesy of Cengage Learning.
Number Representation and Arithmetic Circuits
Lecture 8 Review Combinational Devices –Decoder –Multiplexor (Bhasker p-81) –Shifter –Barrel Shifter (Bhasker p-303)
Lecture #18 Page 1 ECE 4110–5110 Digital System Design Lecture #18 Agenda 1.MSI Demultiplexers 2.MSI Tri-State Buffers 3.MSI Comparators Announcements.
Fundamentals of Digital Signal Processing יהודה אפק, נתן אינטרטור אוניברסיטת תל אביב.
Combinational logic circuit
Describing Combinational Logic Using Processes
CHAPTER 17 VHDL FOR SEQUENTIAL LOGIC
Comparators Discussion DS-3.1.
ENG6530 Reconfigurable Computing Systems
Combinational Circuits Using VHDL
VHDL 1. ver.7a VHDL1 INTRODUCTION TO VHDL (VERY-HIGH-SPEED-INTEGRATED-CIRCUITS HARDWARE DESCRIPTION LANGUAGE) KH WONG (w2 begins) (Some pictures are.
Mano and Kime Sections 7-6 – 7-8
Getting Started with Vivado
Binary-to-BCD Converter
VHDL Structural Architecture
Concurrent vs Sequential
A Greatest Common Divisor (GCD) Processor
ECE 331 – Digital System Design
Single bit comparator Single bit comparator 4/10/2007 DSD,USIT,GGSIPU
High-Low Guessing Game
4-Input Gates VHDL for Loops
디 지 털 시 스 템 설 계 UP2 Kit를 이용한 카운터 설계
Digital Logic with VHDL
(Sequential-Circuit Building Blocks)
Presentation transcript:

2’s Complement 4-Bit Saturator Discussion D2.8 Lab 2

Equality Detector XNOR X Y Z Z = ~(X ^ Y) X Y Z

Z = 1 if A=B=C

NASA Tech Briefs November 2001 X0 X1 X2 X3 X4 X5 c0 c1 Y0 Y1 Y2 Y3 A B X = Y = 1111 X = Y = 0101 X = Y = 0111 X = Y = 1000

-- Title : sat4bit -- Author : haskell Description : Lab2a library IEEE; use IEEE.STD_LOGIC_1164.all; entity sat4bit is port( x : in STD_LOGIC_VECTOR(5 downto 0); y : out STD_LOGIC_VECTOR(3 downto 0) ); end sat4bit; x0 x1 x2 x3 x4 x5 y0 y1 y2 y3 A B c0 c1

architecture sat4bit of sat4bit is signal c0,c1,s: STD_LOGIC; signal A,B:STD_LOGIC_VECTOR(3 downto 0); signal sel: STD_LOGIC_VECTOR(3 downto 0); begin A(3) <= x(5); A(2 downto 0) <= not x(5) & not x(5) & not x(5); B <= x(3 downto 0); c1 <= x(3) xnor x(4); c0 <= x(4) xnor x(5); s <= c0 and c1; sel <= s & s & s & s; y <= (not sel and a) or (sel and b); end sat4bit; x0 x1 x2 x3 x4 x5 c0 c1 y0 y1 y2 y3 A B

The circuit will take a 6-bit two’s complement number with a signed value between –32 and +31 and convert it to a 4-bit two’s complement number with a signed value between –8 and +7. Negative input values less than –8 will be saturated at –8. Positive input values greater than +7 will be saturated at +7. Note the behavior of the circuit Make a truth table to see what the output looks like

xy x(3 downto 0) x(3 downto 0) x(3 downto 0) x(3 downto 0) x(3 downto 0) x(3 downto 0) x(3 downto 0) x(3 downto 0) Truth Table for 2’s Complement 4-Bit Saturator

library IEEE; use IEEE.STD_LOGIC_1164.all; use IEEE.STD_LOGIC_unsigned.all; entity mysat4bit is port( x : in STD_LOGIC_VECTOR(5 downto 0); y : out STD_LOGIC_VECTOR(3 downto 0) ); end mysat4bit; architecture mysat4bit of mysat4bit is begin process(x) begin if x <= "000111" then y <= x(3 downto 0); elsif x <= "011111" then y <= "0111"; elsif x <= "111000"then y <= "1000"; else y <= x(3 downto 0); end if; end process; end mysat4bit; Note: must include this file to use relational operator <= xy x(3 downto 0) x(3 downto 0) x(3 downto 0) x(3 downto 0) x(3 downto 0) x(3 downto 0) x(3 downto 0) x(3 downto 0)