DOC PREVIEW
Berkeley COMPSCI 150 - Hardware Description Languages

This preview shows page 1-2-23-24 out of 24 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 24 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 24 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 24 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 24 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 24 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Hardware Description LanguagesHDLsVerilogStructural ModelSimple behavioral modelSimple Behavioral ModelDriving a SimulationComplete SimulationComparator ExampleMore Complex Behavioral ModelHardware Description Languages vs. Programming LanguagesHardware Description Languages and Combinational LogicHardware Description Languages and Sequential LogicFlip-flop in VerilogMore Flip-flopsStructural View of an FSMBehavioral View of an FSMBehavioral View of an FSM (cont’d)Timer for Traffic Light ControllerComplete Traffic Light ControllerVerilog FSM - Reduce 1s exampleMoore Verilog FSM (cont’d)Mealy Verilog FSMSynchronous Mealy MachineCS 150 - Fall 2000 - Hardware Description Languages - 1Hardware Description LanguagesDescribe hardware at varying levels of abstractionStructural descriptionTextual replacement for schematicHierarchical composition of modules from primitivesBehavioral/functional descriptionDescribe what module does, not howSynthesis generates circuit for moduleSimulation semanticsCS 150 - Fall 2000 - Hardware Description Languages - 2HDLsAbel (circa 1983) - developed by Data-I/OTargeted to programmable logic devicesNot good for much more than state machinesISP (circa 1977) - research project at CMUSimulation, but no synthesisVerilog (circa 1985) - developed by Gateway (absorbed by Cadence)Similar to Pascal and CDelays is only interaction with simulatorFairly efficient and easy to writeIEEE standardVHDL (circa 1987) - DoD sponsored standardSimilar to Ada (emphasis on re-use and maintainability)Simulation semantics visibleVery general but verboseIEEE standardCS 150 - Fall 2000 - Hardware Description Languages - 3VerilogSupports structural and behavioral descriptionsStructuralExplicit structure of the circuitE.g., each logic gate instantiated and connected to othersBehavioralProgram describes input/output behavior of circuitMany structural implementations could have same behaviorE.g., different implementation of one Boolean functionWe’ll only be using behavioral Verilog in DesignWorksRely on schematic when we want structural descriptionsCS 150 - Fall 2000 - Hardware Description Languages - 4module xor_gate (out, a, b); input a, b; output out; wire abar, bbar, t1, t2; inverter invA (abar, a); inverter invB (bbar, b); and_gate and1 (t1, a, bbar); and_gate and2 (t2, b, abar); or_gate or1 (out, t1, t2);endmoduleStructural ModelCS 150 - Fall 2000 - Hardware Description Languages - 5module xor_gate (out, a, b); input a, b; output out; reg out; assign #6 out = a ^ b;endmoduleSimple behavioral modelContinuous assignmentdelay from input changeto output changesimulation register - keeps track ofvalue of signalCS 150 - Fall 2000 - Hardware Description Languages - 6module xor_gate (out, a, b); input a, b; output out; reg out; always @(a or b) begin #6 out = a ^ b; endendmoduleSimple Behavioral Modelalways blockspecifies when block is executed I.e., triggered by which signalsCS 150 - Fall 2000 - Hardware Description Languages - 7module stimulus (x, y); output x, y; reg [1:0] cnt; initial begin cnt = 0; repeat (4) begin #10 cnt = cnt + 1; $display ("@ time=%d, x=%b, y=%b, cnt=%b", $time, x, y, cnt); end #10 $finish; end assign x = cnt[1]; assign y = cnt[0];endmoduleDriving a Simulation2-bit vectorinitial block executed only once at startof simulationdirective to stop simulationprint to a consoleCS 150 - Fall 2000 - Hardware Description Languages - 8Complete Simulation Instantiate stimulus component and device to test in a schematicxyabzCS 150 - Fall 2000 - Hardware Description Languages - 9module Compare1 (A, B, Equal, Alarger, Blarger); input A, B; output Equal, Alarger, Blarger; assign #5 Equal = (A & B) | (~A & ~B); assign #3 Alarger = (A & ~B); assign #3 Blarger = (~A & B);endmodule Comparator ExampleCS 150 - Fall 2000 - Hardware Description Languages - 10module life (n0, n1, n2, n3, n4, n5, n6, n7, self, out); input n0, n1, n2, n3, n4, n5, n6, n7, self; output out; reg out; reg [7:0] neighbors; reg [3:0] count; reg [3:0] i; assign neighbors = {n7, n6, n5, n4, n3, n2, n1, n0}; always @(neighbors or self) begin count = 0; for (i = 0; i < 8; i = i+1) count = count + neighbors[i]; out = (count == 3); out = out | ((self == 1) & (count == 2)); endendmoduleMore Complex Behavioral ModelCS 150 - Fall 2000 - Hardware Description Languages - 11Hardware Description Languages vs. Programming LanguagesProgram StructureInstantiation of multiple components of the same typeSpecify interconnections between modules via schematicHierarchy of modules AssignmentContinuous assignment (logic always computes)Propagation delay (computation takes time)Timing of signals is important (when does computation have its effect)Data structuresSize explicitly spelled out - no dynamic structures No pointersParallelismHardware is naturally parallel (must support multiple threads)Assignments can occur in parallel (not just sequentially)CS 150 - Fall 2000 - Hardware Description Languages - 12Hardware Description Languages and Combinational LogicModules: specification of inputs, outputs, bidirectional, and internal signalsContinuous assignment: a gate's output is a function of its inputs at all times (doesn't need to wait to be "called")Propagation delay: concept of time and delay in input affecting gate outputComposition: connecting modules together with wiresHierarchy: modules encapsulate functional blocksSpecification of don't care conditions (accomplished by setting output to “x”)CS 150 - Fall 2000 - Hardware Description Languages - 13Hardware Description Languages and Sequential LogicFlip-FlopsRepresentation of clocks - timing of state changesAsynchronous vs. synchronousFSMsStructural view (FFs separate from combinational logic)Behavioral view (synthesis of sequencers)Data-paths = ALUs + registersUse of arithmetic/logical operatorsControl of storage elementsParallelismMultiple state machines running in parallelSequential don't caresCS 150 - Fall 2000 - Hardware Description Languages - 14module dff (clk, d, q);input clk, d;output q;reg q;always @(posedge clk)q = d;endmoduleFlip-flop in VerilogUse always block's sensitivity list to


View Full Document

Berkeley COMPSCI 150 - Hardware Description Languages

Documents in this Course
Lab 2

Lab 2

9 pages

Debugging

Debugging

28 pages

Lab 1

Lab 1

15 pages

Memory

Memory

13 pages

Lecture 7

Lecture 7

11 pages

SPDIF

SPDIF

18 pages

Memory

Memory

27 pages

Exam III

Exam III

15 pages

Quiz

Quiz

6 pages

Problem

Problem

3 pages

Memory

Memory

26 pages

Lab 1

Lab 1

9 pages

Memory

Memory

5 pages

Load more
Download Hardware Description Languages
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Hardware Description Languages and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Hardware Description Languages 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?