Bluespec. Lectures 3 & 4 with some slides from Nikhil Rishiyur at Bluespec and Simon Moore at the University of Cambridge

Size: px
Start display at page:

Download "Bluespec. Lectures 3 & 4 with some slides from Nikhil Rishiyur at Bluespec and Simon Moore at the University of Cambridge"

Transcription

1 Bluespec Lectures 3 & 4 with some slides from Nikhil Rishiyur at Bluespec and Simon Moore at the University of Cambridge

2 Course Resources Lecture notes (Power Point, PDF) Example Bluespec programs used in Lectures Complete Photoshop system (Bluespec) Links to Bluespec code samples User guide, reference guide: doc subdirectory of Bluespec installation More information at

3 Rules, not clock edges rules are atomic they execute within one clock cycle structure: rule name (explicit conditions) statements; conditions: explicit conditions (Boolean expression) provided implicit conditions that have to be met to allow the statements to fire, e.g. for fifo.enq only if fifo not full

4 Rules: powerful alternative to always blocks rules for state updates instead of always blocks Simple concept: think if then rule rulename (<boolean cond>); <state update(s)> Rule can execute (or fire ) only when its conditions are TRUE Every rule is atomic with respect to other rules Powerful ramifications: Executable specification design around operations as described in specs Atomicity of rules dramatically reduces concurrency bugs Automates management of shared resources avoids many complex errors

5 Bits, Bools and conversion Bit#(width) vector of bits Bool single bit for Booleans (True, False) pack() function to convert most things (pack) into a bit representation unpack() opposite of pack() extend() extend an integer (signed, unsigned, bits) truncate() truncate an integer

6 Reg and Bit/Uint/Int types registers (initialised and uninitialised versions): Reg#(type) name0 <- mkreg(initial_value); Reg#(type) name1 <- mkregu; interface type type parameter (e.g. UInt#(8)) since Reg is generic name of module to make (i.e. instantiate) N.B. modules are typically prefixed mk some types (unsigned and signed integer, and bits): UInt#(width), Int#(width), Bit#(width) example: Reg#(UInt#(8)) counter <- mkreg(0); rule count_up; counter <= counter+1;

7 Registers interface Reg#(type a); method Action _write (a x1); method a _read (); endinterface: Reg Polymorphic Just library elements In one cycle register reads must execute before register writes x <= y + 1 is syntactic sugar for x._write (y._read + 1)

8 Scheduling Annotations C CF SB SBR SA SAR Conflict Conflict free Sequence before Sequence before restricted (cannot be in the same rule) Sequence after Sequence after restricted (cannot be in the same rule)

9 Scheduling Annotations for a Register read write read CF SB write SA SBR Two read methods would be conflict-free (CF), that is, you could have multiple methods that read from the same register in the same rule, sequenced in any order. A write is sequenced after (SA) a read. A read is sequenced before (SB) a write. If you have two write methods, one must be sequenced before the other, and they cannot be in the same rule, as indicated by the annotation SBR.

10 Updating Registers Reg#(int) x <- mkreg (0) ; rule countup (x < 30); int y = x + 1; x <= x + 1; $display ("x = %0d, y = %0d", x, y);

11 Rules of Rules (The Three Basics) 1. Rules are atomic 2. Rules fire or don t at most once per cycle 3. Rules don t conflict with other rules

12 D x Q +1 D y Q +1 rule r1; x <= y + 1; rule r2; y <= x + 1; clk

13 (* synthesize *) module rules4 (Empty); D x2 Q +1 Reg#(int) x <- mkreg (10); Reg#(int) y <- mkreg (100); rule r1; x <= y + 1; D y2 Q +1 rule r2; y <= x + 1; clk $./rules4 -m 5 x, y = 10, 100 x, y = 10, 11 x, y = 10, 11 x, y = 10, 11 rule monitor; $display ("x, y = %0d, %0d ", x, y); endmodule

14 D x Q +1 (* synthesize *) module rules5 (Empty); Reg#(int) x <- mkreg (10); Reg#(int) y <- mkreg (100); D y Q +1 rule r ; x <= y + 1; y <= x + 1; clk rule monitor; $display ("x, y = %0d, %0d ", x, y); endmodule $./rules5 -m 5 x, y = 10, 100 x, y = 101, 11 x, y = 12, 102 x, y = 103, 13

15 (* synthesize *) module rules6 (Empty); D x2 Q +1 Reg#(int) x <- mkreg (10); Reg#(int) y <- mkreg (100); rule r1; x <= y + 1; D y2 Q +1 rule r2; y <= x + 1; (* descending_urgency = "r1, r2" *) clk $./rules6 -m 5 x, y = 10, 100 x, y = 101, 100 x, y = 101, 100 x, y = 101, 100 rule monitor; $display ("x, y = %0d, %0d ", x, y); endmodule

16 interface Rules7_Interface ; method int readvalue ; method Action setvalue (int newxvalue) ; method ActionValue#(int) increment ; endinterface (* synthesize *) module rules7 (Rules7_Interface); Reg#(int) x <- mkreg (0); method readvalue ; return x ; endmethod method Action setvalue (int newxvalue); x <= newxvalue ; endmethod method ActionValue#(int) increment ; x <= x + 1 ; return x ; endmethod endmodule

17 interface Rules7_Interface ; (* always_ready *) method int readresult ; (* always_enabled *) method Action setvalues (int newx, int newy, int newz) ; endinterface (* synthesize *) module rules7 (Rules7_Interface) ; Reg#(int) x <- mkreg (0) ; Reg#(int) y <- mkreg (0) ; Reg#(int) z <- mkreg (0) ; Reg#(int) result <- mkregu ; Reg#(Bool) b <- mkreg (False) ; rule toggle ; b <=!b ; // remaining internal signals assign x_mul_y d8 = x * y ; assign x_mul_z d5 = x * z ; rule r1 (b) ; result <= x * y ; rule r2 (!b) ; result <= x * z ; method readresult = result ; method Action setvalues (int newx, int newy, int newz) ; x <= newx ; y <= newy ; z <= newz ; endmethod endmodule

18

19 interface Rules8_Interface ; (* always_ready *) method int readresult ; (* always_enabled *) method Action setvalues (int newx, int newy, int newz) ; endinterface (* synthesize *) module rules8 (Rules8_Interface) ; Reg#(int) x <- mkreg (0) ; Reg#(int) y <- mkreg (0) ; Reg#(int) z <- mkreg (0) ; Wire#(int) t <- mkwire ; Reg#(int) result <- mkregu ; Reg#(Bool) b <- mkreg (False) ; rule toggle ; b <=!b ; rule computet ; if (b) t <= y ; else t <= z ; rule r1 (b) ; result <= x * t ; // inlined wires assign t$wget = b? y : z ; // remaining internal signals assign x_mul_t_wget d6 = x * t$wget ; method readresult = result ; method Action setvalues (int newx, int newy, int newz) ; x <= newx ; y <= newy ; z <= newz ; endmethod endmodule

20

21 High Level Synthesis Most work on high level synthesis focuses on the automation scheduling and allocation to achieve resource sharing. Perspective: high level synthesis in general applies to many aspects of converting high level descriptions into efficient circuits but there has been an undue level of effort on resource sharing in an ASIC context. Bluespec automates many aspects of scheduling (it makes scheduling composable) but resource usage is under the explicit control of the designer. For FPGA-based design this is often a better bit as a programming model.

22 Simple example with concurrency and shared resources cond0 cond1 cond x y Process 0: increments register x when cond0 Process 1: transfers a unit from register x to register y when cond1 Process 2: decrements register y when cond2 Process priority: 2 > 1 > 0 Each register can only be updated by one process on each clock. Priority: 2 > 1 > 0 Just like real applications, e.g.: Bank account: 0 = deposit to checking, 1 = transfer from checking to savings, 2 = withdraw from savings

23 cond0 cond1 cond2 CLK) begin if (cond2) y <= y 1; else if (cond1) begin y <= y + 1; x <= x 1; end Process priority: 2 > 1 > 0 x y CLK) begin if (cond2) y <= y 1; else if (cond1) begin y <= y + 1; x <= x 1; end Resource-access scheduling logic i.e., control logic Better scheduling if (cond0 &&!cond1) x <= x + 1; end if (cond0 && (!cond1 cond2) ) x <= x + 1; end * There are other ways to write this RTL, but all suffer from same analysis Fundamentally, we are scheduling three potentially concurrent atomic transactions that share resources. What if the priorities changed: cond1 > cond2 > cond0? What if the processes are in different modules?

24 With Bluespec, the design is direct cond0 cond1 cond x y Process priority: 2 > 1 > 0 (* descending_urgency = proc2, proc1, proc0 *) rule proc0 (cond0); x <= x + 1; rule proc1 (cond1); y <= y + 1; x <= x 1; rule proc2 (cond2); y <= y 1; Hand-written RTL: Explicit scheduling Complex clutter, unmaintainable BSV: Functional correctness follows directly from rule semantics (atomicity) Executable spec (operation-centric) Automatic handling of shared resource control logic Same hardware as the RTL

25 Now, let s make a small change: add a new process and insert its priority cond0 cond1 cond x cond3 Process priority: 2 > 3 > 1 > 0 y -1 2

26 Changing the Bluespec design cond0 cond1 cond x Pre-Change cond3 y -1 2 Process priority: 2 > 3 > 1 > 0 (* descending_urgency = "proc2, proc3, proc1, proc0" *) (* descending_urgency = proc2, proc1, proc0 *) rule proc0 (cond0); x <= x + 1; rule proc1 (cond1); y <= y + 1; x <= x 1; rule proc2 (cond2); y <= y 1; rule proc0 (cond0); x <= x + 1; rule proc1 (cond1); y <= y + 1; x <= x - 1; rule proc2 (cond2); y <= y - 1; x <= x + 1; rule proc3 (cond3); y <= y - 2; x <= x + 2;?

27 Changing the Verilog design cond0 cond1 cond2 Process priority: 2 > 3 > 1 > x y -1 2 cond3 Pre-Change CLK) begin if (!cond2 && cond1) x <= x 1; else if (cond0) x <= x + 1; if (cond2) y <= y 1; else if (cond1) y <= y + 1; end CLK) begin if ((cond2 && cond0) (cond0 &&!cond1 &&!cond3)) x <= x + 1; else if (cond3 &&!cond2)? x <= x + 2; else if (cond1 &&!cond2) x <= x - 1 if (cond2) y <= y - 1; else if (cond3) y <= y - 2; else if (cond1) y <= y + 1; end

28 Alternate RTL style (more common) cond0 cond1 cond Process priority: 2 > 1 > 0 x y (posedge clk) case ({cond0, cond1, cond2}) 3'b000: begin // nothing happens x <= x; y <= y; end 3'b001: begin //proc2 fires y <= y-1; end 3'b010: begin //proc1 x <= x-1; y <= y+1; end 3'b011: begin //proc2 fires (2>1) y <= y-1; end 3'b100: begin //proc0 x <= x+1; end 3'b101: begin //proc2 + proc0 x <= x+1; y <= y-1; end 3'b110: begin //proc1 (1>0) x <= x-1; y <= y+1; end 3'b111: begin //proc2 + proc0 x <= x+1; // NOTE subtle! y <= y-1; end endcase Combinatorial explosion Case 3 b111 is subtle Many repetitions of update actions ( cut-paste errors) cf. WTO Principle (Write Things Once Gerard Berry) Difficult to maintain/extend Difficult to modularize

29 Late Specifications Late specification changes and feature enhancements are challenging to deal with. Micro-architectural changes for timing/area/performance, e.g.: Adding a pipeline stage to an existing pipeline Adding a pipeline stage where pipelining was not anticipated Spreading a calculation over more clocks (longer iteration) Moving logic across a register stage (rebalancing) Restructuring combinational clouds for shallower logic Fixing bugs Bluespec makes it easier to try out multiple macro/micro-architectures earlier in the design cycle

30 Why Rule atomicity improves correctness Correctness is often couched (formally or informally) as an invariant E.g., # ingress packets # egress packets == packet-count register value Rule atomicity improves thinking about (and formally proving) invariants, because invariants can be verified one rule at a time In contrast, in RTL and thread models, must think of all possible interleavings cf. The Problem With Threads, Edward A. Lee, IEEE Computer 39(5), May 2006, pp

31 Bank Account: Key Benefits Executable specifications Rapid changes But, with fine-grained control of RTL: Define the optimal architecture/microarchitecture Debug at the source OR RTL level designer understands both The Quality of Results (QoR) of RTL!

32 A more complex example, from CPU design Speculative, out-of-order Many, many concurrent activities Register File Fetch FIFO Decode Branch FIFO Re- Order Buffer (ROB) FIFO FIFO FIFO FIFO ALU Unit MEM Unit FIFO FIFO FIFO FIFO Instruction Memory Data Memory

33 Many concurrent actions on common state: nightmare to manage explicitly Get operands for instr Register File Writeback results Empty Waiting E W E Re-Order Buffer State Instruction Operand 1 Operand 2 Result Instr - V - V - - Decode Unit Put an instr into ROB Head Tail E W W W W E E Instr - V - V - - Instr A V 0 V 0 - Instr B V 0 V 0 - Instr C V 0 V 0 - Instr D V 0 V 0 Instr - V - V - - Instr - V - V Get a ready ALU instr Put ALU instr results in ROB ALU Unit(s) Resolve branches E E E E E E Instr - V - V - - Instr - V - V - - Instr - V - V - - Instr - V - V - - Instr - V - V - - Instr - V - V - - Get a ready MEM instr Put MEM instr results in ROB MEM Unit(s) E E Instr - V - V Instr - V - V - -

34 In Bluespec..you can code each operation in isolation, as a rule..the tool guarantees that operations are INTERLOCKED (i.e. each runs to completion without external interference) Branch Resolution Commit Instr Write results to register Write Back Results file to ROB (or allow memory write for store) Write back results to instr result Set to Empty Dispatch Instr Write back to all waiting Increment head pointer Mark instruction tags Insert Instr in ROB dispatched Set to done Put instruction in first Forward to appropriate available slot unit Increment tail pointer Get source operands - RF <or> prev instr

35 cond0 cond1 cond Process priority: 2 > 1 > 0 x y Which one is correct? CLK) begin if (!cond2 && cond1) x <= x 1; else if (cond0) x <= x + 1; if (cond2) y <= y 1; else if (cond1) y <= y + 1; end CLK) begin if (!cond2 cond1) x <= x 1; else if (cond0) x <= x + 1; if (cond2) y <= y 1; else if (cond1) y <= y + 1; end What s required to verify that they re correct? What if the priorities changed: cond1 > cond2 > cond0? What if the processes are in different modules?

36 Some Verilog solutions cond0 cond1 cond2 Which one is correct? x y CLK) begin if (!cond2 && cond1) x <= x 1; else if (cond0) x <= x + 1; if (cond2) y <= y 1; else if (cond1) y <= y + 1; end Process priority: 2 > 1 > 0 CLK) begin if (!cond2 cond1) x <= x 1; else if (cond0) x <= x + 1; if (cond2) y <= y 1; else if (cond1) y <= y + 1; end Functional code and scheduling code are deeply (inextricably) intertwined. What s required to verify that they re correct? What if the priorities changed: cond1 > cond2 > cond0? What if the processes are in different modules?

37 Finite State Machines in Bluespec for makigncomposable, parallel, nested, suspendable/abortable FSMs sequencing if-then-else sequential loops parallel FSMs (fork-join) hierarchy (with suspend and abort) fsm fsm fsm fsm fsm fsm fsm fsm fsm fsm Enables exponentially smaller descriptions compared to flat FSMs Features: FSMs automatically synthesized Complex FSMs expressed succinctly FSM actions have same atomic semantics as BSV rule bodies Well-behaved on shared resources no surprises Standard BSV interfaces and BSV s higher-order functions can write your own FSM generators 37 This powerful capability is enabled by higher-order functions, polymorphic types, advanced parameterization and atomic transactions

38 FSM example (from testbench stimulus section) Stmt s = seq action rand_packets0.init; rand_packets1.init; endaction par for (j0 <= 0; j0 < n; j0 <= j0 + 1) action let pkt0 <- rand_packets0.next; switch.ports[0].put (pkt0); endaction for (j1 <= 0; j1 < n; j1 <= j1 + 1) action let pkt1 <- rand_packets1.next; switch.ports[1].put (pkt1); endaction endpar drain_switch; endseq; FSM fsm <- mkfsm (s); 38 rule go; s.start; Basic FSM statements are Actions, just like rule bodies, and have exactly the same atomic semantics. Thus, BSV FSMs are well-behaved with respect to concurrent resource contention and flow control.

39 Strong support for multiple clock and reset domains Rich and mature support for MCD (multiple clock domains and resets) Clock is a first-class data type Cannot accidentally mix clocks and ordinary signals Strong static checking ensures that it is impossible to accidentally cross clock domain boundaries (i.e., without a synchronizer) No need for linting tools to check domain discipline Clock manipulation Clocks can be passed in and out of module interfaces Library of clock dividers and other transformations Module instantiation can specify an alternative clock (instead of inheriting parent s default clock) (Similarly: Reset and reset domains) 39

40 Synthesis of Atomic Actions Compute Predicates for each rule p 1 p 2 p 3 scheduler Select maximal subset of applicable rules state read Predicates computed for each rule with a combinational circuit f 1 f 2 f 3 enabled rules Compute next state for each rule d 1 d 2 Selector Mux s & priority encoders update Potential update functions d 3

41 Key Issue: How to select to maximal subset of rules for firing? Two rules R1 and R2 can execute simultaneously if they are conflict free i.e. R1 and R2 do not update the same state; and Neither R1 or R2 do not read the that the other updates ( sequentially composable rules)

42 Rules of Rules (The Details 1-5/10) 1. Rules are atomic: rules fire completely or not at all, and you can imagine that nothing else happens during their execution. 2. Explicit and implicit conditions may prevent rules from firing. 3. Every rule fires exactly 0 or 1 times every cycle (at this point in our product's history anyway ;) 4. Rules that conflict in some way may fire together in the same cycle, but only if the compiler can schedule them in a valid order to do so -- that is, where the overall effect is as if they had happened one at at time as in (1) above. 5. Rules determine if they are going to fire or not before they actually do so. They are considered in their order of "urgency" (by a "greedy algorithm"): they "will fire" if they "can fire" and are not prevented by a conflict with a rule which has been selected already. It's OK to think of this phase as being completed (except for wires) before any rules are actually executed. This is what "urgency" is about.

43 Rules of Rules (The Details 6-10/10) 6. After determining which rules are going to fire, the simulator can then schedule their execution. (In hardware it's all done by combinational logic which has the same effect.) Rules do not need to execute in the same order as they were considered for deciding whether they "will fire". For example rule1 can have a higher urgency than rule2, but it is possible that rule2 executes its logic before rule1. Urgency is used to determine which rules "will fire. Earliness defines the order they fire in. 7. All reads from a register must be scheduled before any writes to the same register: any rule which reads from a register must be scheduled "earlier" than any other rule which writes to it. 8. Constants may be "read" at any time; a register *might* have a write but no read. 9. The compiler creates a sequence of steps, where each step is essentially a rule firing. Its inputs are valid at the beginning of the cycle, its outputs are valid at the end of the cycle. Data is not allowed to be driven "backwards" in the schedule: that is, no action may influence any action that happened "earlier" in the cycle. This would go against causality, and constitutes a "feedback" path that the compiler will not allow. 10. If the compiler is not told otherwise, methods have higher urgency than rules, and will execute earlier than rules, unless there's some reason to the contrary. There is a compiler switch to flip this around and make rules have higher urgency.

44 (* synthesize *) module rules9 (Empty) ; The Swap Conundrum Reg#(int) x <- mkreg (12) ; Reg#(int) y <- mkreg (17) ; rule r1 ; x <= y ; rule r2 ; y <= x ; $./rules9 -m 5 x, y = 12, 17 x, y = 12, 12 x, y = 12, 12 x, y = 12, 12 rule monitor ; $display ("x, y = %0d, %0d", x, y) ; endmodule

45 (* synthesize *) module rules9 (Empty) ; The Swap Conundrum Reg#(int) x <- mkreg (12) ; Reg#(int) y <- mkreg (17) ; rule r1 ; x <= y ; rule r2 ; y <= x ; rule r1 (tick 1) x._write (y._read ()) y read x write rule r2 (tick 2) y._write(x._read()) x read y write PROBLEM: register x must read before write rule monitor ; $display ("x, y = %0d, %0d", x, y) ; endmodule

46 (* synthesize *) module rules10 (Empty) ; Reg#(int) x <- mkreg (12) ; Reg#(int) y <- mkreg (17) ; rule r ; x <= y ; y <= x ; rule monitor ; $display ("x, y = %0d, %0d", x, y) ; endmodule $./rules10 -m 5 x, y = 12, 17 x, y = 17, 12 x, y = 12, 17 x, y = 17, 12 Schedule wise, step 1 reads x and y at the beginning and writes x and y at the end.

47 Wires In Bluespec from a scheduling perspective registers and wires are dual concepts. In one cycle all register reads must execute before register writes. In one cycle a wire must be written to (at most once) before it is read (any number of times).

48 Rules of Wires Wires truly become wires in hardware: they do not save state between cycles (compare to signal in VHDL). A wire s schedule requires that it be written before it is read (as opposed to a register that is read before it is written). A wire can not be written more than once in a cycle.

49 (* synthesize *) module rules11 (Empty) ; Reg#(int) x <- mkreg (12) ; Reg#(int) y <- mkreg (17) ; Wire#(int) xwire <- mkwire; rule r1 ; x <= y ; rule r2 ; y <= xwire ; $./rules11 -m 5 x, y = 12, 17 x, y = 17, 12 x, y = 12, 17 x, y = 17, 12 rule drivex ; xwire <= x ; rule monitor ; $display ("x, y = %0d, %0d", x, y) ; endmodule

50 (* synthesize *) module rules11 (Empty) ; Reg#(int) x <- mkreg (12) ; Reg#(int) y <- mkreg (17) ; Wire#(int) xwire <- mkwire; rule r1 ; x <= y ; rule r2 ; y <= xwire ; rule drivex ; xwire <= x ; $ cat rules11.sched === Generated schedule for rules11 === Rule schedule Rule: monitor Predicate: True Blocking rules: (none) Rule: drivex Predicate: True Blocking rules: (none) Rule: r2 Predicate: xwire.whas Blocking rules: (none) Rule: r1 Predicate: True Blocking rules: (none) Logical execution order: monitor, drivex, r1, r2 rule monitor ; $display ("x, y = %0d, %0d", x, y) ; endmodule ======================================= Question: is monitor, drivex, r2, r1 a valid schedule?

51 Wire Implements Reg interface (_read and _write methods). Implicit condition: it not ready if it has not been written In any cycle if there is no write to a wire then any rule that reads that wire is blocked (it can not fire).

52 (* synthesize *) module rules12 (Empty) ; Reg#(int) y <- mkreg (17) ; Reg#(int) count <- mkreg (0) ; Wire#(int) x <- mkwire; rule producer ; if (count % 3 == 0) x <= count ; rule consumer ; y <= x ; $display ("cycle %0d: y set to %0d", count, x) ; rule counter ; count <= count + 1 ; endmodule $./rules12 -m 9 cycle 0: y set to 0 cycle 3: y set to 3 cycle 6: y set to 6

53 DWire A Wire with a default value. A Dwire is always ready. If there is a write to a DWire in a cycle then just like a Wire it assumes that value. If there is no write to a DWire in a cycle it assumes a default value (given at instantiation time).

54 (* synthesize *) module rules13 (Empty) ; Reg#(int) y <- mkreg (17) ; Reg#(int) count <- mkreg (0) ; Wire#(int) x <- mkdwire (42); rule producer ; if (count % 3 == 0) x <= count ; rule consumer ; y <= x ; $display ("cycle %0d: y set to %0d", count, x) ; rule counter ; count <= count + 1 ; endmodule $ cycle 1: y set to 42 cycle 2: y set to 42 cycle 3: y set to 3 cycle 4: y set to 42 cycle 5: y set to 42 cycle 6: y set to 6 cycle 7: y set to 42

55 BypassWire Closest thing to a wire in Verilog. A BypassWire is always ready. Rather than having a default value the compiler must be able to statically determine that this wire is driven on every cycle.

56 FIFOs Lots and lots of FIFOs provided in FIFO, FIFOF, SpecialFIFOs libraries Examples (2 and 4 element FIFOs): FIFO#(UInt#(8)) myfifo <- mkfifo; FIFO#(UInt#(8)) biggerfifo <- mksizedfifo(4); Example BypassFIFO (1 storage element, data passes straight through if enq and deq on same cycle when empty) FIFO#(UInt#(8)) bypassfifo <- mkbypassfifo; Basic interfaces: enq(value) // enqueue value first // returns first element of fifo deq // dequeue

57 import FIFO::*; (* synthesize *) module rules14 (Empty) ; Reg#(int) count <- mkreg (0) ; FIFO#(int) fifo <- mksizedfifo (30); rule producer (count < 5) ; fifo.enq (count*3) ; $display ("cycle %0d: enqeuing value %d", count, count*3) ; rule consumer (count > 5) ; int x = fifo.first ; fifo.deq ; $display ("cycle %0d: deqeued value %0d", count, x) ; rule counter ; count <= count + 1 ; endmodule $./rules14 -m 20 cycle 0: enqeuing value 0 cycle 1: enqeuing value 3 cycle 2: enqeuing value 6 cycle 3: enqeuing value 9 cycle 4: enqeuing value 12 cycle 6: deqeued value 0 cycle 7: deqeued value 3 cycle 8: deqeued value 6 cycle 9: deqeued value 9 cycle 10: deqeued value 12

58 import FIFO::*; (* synthesize *) module rules15 (Empty) ; Reg#(int) count <- mkreg (0) ; FIFO#(int) fifo <- mksizedfifo (30); rule producer (count < 5) ; fifo.enq (count*3) ; $display ("cycle %0d: enqeuing value %0d", count, count*3) ; rule consumer (count < 5) ; int x = fifo.first ; fifo.deq ; $display ("cycle %0d: deqeued value %0d", count, x) ; rule counter ; count <= count + 1 ; endmodule

59 import GetPut::* ; import Connectable::* ; module mkproducer (Get#(int)) ; Reg#(int) i <- mkreg (0) ; rule incrementi ; i <= i + 1 ; method ActionValue#(int) get () ; return i ; endmethod endmodule: mkproducer (* synthesize *) module mkconnectableexample(empty) ; Get#(int) p <- mkproducer ; Put#(int) c <- mkconsumer ; mkconnection (p, c) ; endmodule: mkconnectabletest module mkconsumer (Put#(int)) ; Wire#(int) i <- mkwire ; rule report ; $display ("mkconsumer %d", i) ; Higher Order Types p and c are methods which are passed as arguments method Action put (int x) ; i <= x ; endmethod endmodule: mkconsumer

60 request response request response request response ServerFarm Information Flow ServerFarm DividerServer DividerServer

61 Conclusions Bluespec: provides cleaner interfaces quicker to create large systems from libraries of components easier to refine design creates most of the control for you (unless you don t want it to) less likely to get it wrong! has strong typing helps remove bugs provides powerful static elaboration

Bluespec SystemVerilog TM Training. Lecture 05: Rules. Copyright Bluespec, Inc., Lecture 05: Rules

Bluespec SystemVerilog TM Training. Lecture 05: Rules. Copyright Bluespec, Inc., Lecture 05: Rules Bluespec SystemVerilog Training Copyright Bluespec, Inc., 2005-2008 Rules: conditions, actions Rule Untimed Semantics Non-determinism Functional correctness: atomicity, invariants Examples Performance

More information

The Pipeline Lab Copyright Bluespec Inc

The Pipeline Lab Copyright Bluespec Inc The Pipeline Lab Hello Bluespec! This lab will lead you through basic aspects of the BSV (Bluespec SystemVerilog) language and the usage of the Bluespec compiler (bsc) for Bluesim and Verilog simulations.

More information

Arvind (with the help of Nirav Dave) Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

Arvind (with the help of Nirav Dave) Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Stmt FSM Arvind (with the help of Nirav Dave) Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology March 10, 2010 http://csg.csail.mit.edu/snu L9-1 Motivation Some common

More information

Lecture 06: Rule Scheduling

Lecture 06: Rule Scheduling Bluespec SystemVerilog Training Lecture 06: Rule Scheduling Copyright Bluespec, Inc., 2005-2008 Lecture 06: Rule Scheduling A rule has no internal sequencing Untimed rule semantics are one-rule-at-a-time

More information

Hardware Synthesis from Bluespec

Hardware Synthesis from Bluespec Hardware Synthesis from Bluespec Silvina Hanono Wachman Computer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology Happy! Day! L11-1 Guarded interfaces Modules with guarded interfaces

More information

Bluespec-4: Rule Scheduling and Synthesis. Synthesis: From State & Rules into Synchronous FSMs

Bluespec-4: Rule Scheduling and Synthesis. Synthesis: From State & Rules into Synchronous FSMs Bluespec-4: Rule Scheduling and Synthesis Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Based on material prepared by Bluespec Inc, January 2005 March 2, 2005

More information

VHDL vs. BSV: A case study on a Java-optimized processor

VHDL vs. BSV: A case study on a Java-optimized processor VHDL vs. BSV: A case study on a Java-optimized processor April 18, 2007 Outline Introduction Goal Design parameters Goal Design parameters What are we trying to do? Compare BlueSpec SystemVerilog (BSV)

More information

Elastic Pipelines and Basics of Multi-rule Systems. Elastic pipeline Use FIFOs instead of pipeline registers

Elastic Pipelines and Basics of Multi-rule Systems. Elastic pipeline Use FIFOs instead of pipeline registers Elastic Pipelines and Basics of Multi-rule Systems Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L05-1 Elastic pipeline Use FIFOs instead of pipeline registers

More information

Sequential Circuits as Modules with Interfaces. Arvind Computer Science & Artificial Intelligence Lab M.I.T.

Sequential Circuits as Modules with Interfaces. Arvind Computer Science & Artificial Intelligence Lab M.I.T. Sequential Circuits as Modules with Interfaces Arvind Computer Science & Artificial Intelligence Lab M.I.T. L07-1 Shortcomings of the current hardware design practice Complex hardware is viewed as a bunch

More information

Lecture 09: More on Module Interfaces

Lecture 09: More on Module Interfaces Bluespec SystemVerilog Training Lecture 09: More on Module Interfaces Copyright Bluespec, Inc., 2005-2008 Lecture 09: More on Module Interfaces Packages and Libraries Interfaces: raising the level of abstraction

More information

VHDL simulation and synthesis

VHDL simulation and synthesis VHDL simulation and synthesis How we treat VHDL in this course You will not become an expert in VHDL after taking this course The goal is that you should learn how VHDL can be used for simulation and synthesis

More information

Multiple Clock Domains

Multiple Clock Domains Multiple Clock Domains (MCD) Arvind with Nirav Dave Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology March 15, 2010 http://csg.csail.mit.edu/6.375 L12-1 Plan Why Multiple

More information

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 11. Introduction to Verilog II Sequential Circuits

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 11. Introduction to Verilog II Sequential Circuits Name: Instructor: Engr. Date Performed: Marks Obtained: /10 Group Members (ID):. Checked By: Date: Experiment # 11 Introduction to Verilog II Sequential Circuits OBJECTIVES: To understand the concepts

More information

Synthesizable Verilog

Synthesizable Verilog Synthesizable Verilog Courtesy of Dr. Edwards@Columbia, and Dr. Franzon@NCSU http://csce.uark.edu +1 (479) 575-6043 yrpeng@uark.edu Design Methodology Structure and Function (Behavior) of a Design HDL

More information

BeiHang Short Course, Part 2: Description and Synthesis

BeiHang Short Course, Part 2: Description and Synthesis BeiHang Short Course, Part 2: Operation Centric Hardware Description and Synthesis J. C. Hoe, CMU/ECE/CALCM, 2014, BHSC L2 s1 James C. Hoe Department of ECE Carnegie Mellon University Collaborator: Arvind

More information

Lab 4: N-Element FIFOs 6.175: Constructive Computer Architecture Fall 2014

Lab 4: N-Element FIFOs 6.175: Constructive Computer Architecture Fall 2014 Lab 4: N-Element FIFOs Due: Wednesday October 8, 2014 1 Introduction This lab focuses on the design of various N-element FIFOs including a conflict-free FIFO. Conflict-free FIFOs are an essential tool

More information

Modular Refinement. Successive refinement & Modular Structure

Modular Refinement. Successive refinement & Modular Structure Modular Refinement Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L09-1 Successive refinement & Modular Structure pc rf fetch decode execute memory writeback

More information

A Parameterized Model of a Crossbar Switch In Bluespec SystemVerilog (TM) June 30, Copyright Bluespec, Inc., 2005, All Rights Reserved

A Parameterized Model of a Crossbar Switch In Bluespec SystemVerilog (TM) June 30, Copyright Bluespec, Inc., 2005, All Rights Reserved Introduction A Parameterized Model of a Crossbar Switch In Bluespec SystemVerilog (TM) June 30, 2005 Copyright Bluespec, Inc., 2005, All Rights Reserved This document describes the design of a highly parameterized,

More information

Introduction to Verilog

Introduction to Verilog Introduction to Verilog Synthesis and HDLs Verilog: The Module Continuous (Dataflow) Assignment Gate Level Description Procedural Assignment with always Verilog Registers Mix-and-Match Assignments The

More information

BSV 1 for ESL 2 Design. SoCs: complex assemblies of many application specific blocks (IPs)

BSV 1 for ESL 2 Design. SoCs: complex assemblies of many application specific blocks (IPs) BSV 1 for ESL 2 Design Rishiyur S. Nikhil, PhD. CTO, Bluespec, Inc. Lecture in 6.375, MIT March 10, 2008 1: Bluespec SystemVerilog 2: Electronic System Level Bluespec, Inc., 2008 SoCs: complex assemblies

More information

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1 FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1 Anurag Dwivedi Digital Design : Bottom Up Approach Basic Block - Gates Digital Design : Bottom Up Approach Gates -> Flip Flops Digital

More information

IBM Power Multithreaded Parallelism: Languages and Compilers. Fall Nirav Dave

IBM Power Multithreaded Parallelism: Languages and Compilers. Fall Nirav Dave 6.827 Multithreaded Parallelism: Languages and Compilers Fall 2006 Lecturer: TA: Assistant: Arvind Nirav Dave Sally Lee L01-1 IBM Power 5 130nm SOI CMOS with Cu 389mm 2 2GHz 276 million transistors Dual

More information

ECE 551: Digital System *

ECE 551: Digital System * ECE 551: Digital System * Design & Synthesis Lecture Set 5 5.1: Verilog Behavioral Model for Finite State Machines (FSMs) 5.2: Verilog Simulation I/O and 2001 Standard (In Separate File) 3/4/2003 1 Explicit

More information

IP Lookup block in a router

IP Lookup block in a router P Lookup Arvind Computer Science & Artificial ntelligence Lab Massachusetts nstitute of Technology L07-1 P Lookup block in a router Packet Processor S (lookup table) P Lookup Line Card (LC) Control Processor

More information

CS232 VHDL Lecture. Types

CS232 VHDL Lecture. Types CS232 VHDL Lecture VHSIC Hardware Description Language [VHDL] is a language used to define and describe the behavior of digital circuits. Unlike most other programming languages, VHDL is explicitly parallel.

More information

Elastic Pipelines: Concurrency Issues

Elastic Pipelines: Concurrency Issues Elastic Pipelines: Concurrency Issues Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L08-1 Inelastic vs Elastic Pipelines In a Inelastic pipeline: pp typically

More information

VHDL: RTL Synthesis Basics. 1 of 59

VHDL: RTL Synthesis Basics. 1 of 59 VHDL: RTL Synthesis Basics 1 of 59 Goals To learn the basics of RTL synthesis. To be able to synthesize a digital system, given its VHDL model. To be able to relate VHDL code to its synthesized output.

More information

Elastic Pipelines: Concurrency Issues

Elastic Pipelines: Concurrency Issues Elastic Pipelines: Concurrency Issues Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L09-1 Inelastic vs Elastic Pipelines In a Inelastic pipeline: pp typically

More information

The Verilog Language COMS W Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science

The Verilog Language COMS W Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science The Verilog Language COMS W4995-02 Prof. Stephen A. Edwards Fall 2002 Columbia University Department of Computer Science The Verilog Language Originally a modeling language for a very efficient event-driven

More information

or Arvind goes commercial Joe Stoy, May

or Arvind goes commercial Joe Stoy, May or Arvind goes commercial Joe Stoy, May 18 2007 Bluespec, Inc., 2006 Network evolution: IP Sprawl Managed Switch/Router Professional Park ADM Metropolitan Area or Regional Area Service Provider ADM ADM

More information

EEL 4783: HDL in Digital System Design

EEL 4783: HDL in Digital System Design EEL 4783: HDL in Digital System Design Lecture 15: Logic Synthesis with Verilog Prof. Mingjie Lin 1 Verilog Synthesis Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for

More information

Verification with Bluespec SystemVerilog Bluespec, Inc., All Rights Reserved

Verification with Bluespec SystemVerilog Bluespec, Inc., All Rights Reserved Verification with Bluespec SystemVerilog 2005 2006 Bluespec, Inc., All Rights Reserved 1 Abstract Bluespec SystemVerilog (BSV) is an advanced high-level Hardware Description Language that can increase

More information

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering Verilog Fundamentals Shubham Singh Junior Undergrad. Electrical Engineering VERILOG FUNDAMENTALS HDLs HISTORY HOW FPGA & VERILOG ARE RELATED CODING IN VERILOG HDLs HISTORY HDL HARDWARE DESCRIPTION LANGUAGE

More information

Architecture exploration in Bluespec

Architecture exploration in Bluespec Architecture exploration in Bluespec Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Guest Lecture 6.973 (lecture 7) L-1 Chip design has become too risky a business

More information

Bluespec for a Pipelined SMIPSv2 Processor

Bluespec for a Pipelined SMIPSv2 Processor Bluespec for a Pipelined SMIPSv2 Processor 6.375 Laboratory 2 February 14, 2008 The second laboratory assignment is to implement a pipelined SMIPSv2 in Bluespec SystemVerilog. As with Lab One, your deliverables

More information

Synthesis of Combinational and Sequential Circuits with Verilog

Synthesis of Combinational and Sequential Circuits with Verilog Synthesis of Combinational and Sequential Circuits with Verilog What is Verilog? Hardware description language: Are used to describe digital system in text form Used for modeling, simulation, design Two

More information

CSE140L: Components and Design Techniques for Digital Systems Lab

CSE140L: Components and Design Techniques for Digital Systems Lab CSE140L: Components and Design Techniques for Digital Systems Lab Tajana Simunic Rosing Source: Vahid, Katz, Culler 1 Announcements & Outline Lab 4 due; demo signup times listed on the cse140l site Check

More information

Super Advanced BSV* Andy Wright. October 24, *Edited for Tutorial 6. Andy Wright Super Advanced BSV* October 24, / 25

Super Advanced BSV* Andy Wright. October 24, *Edited for Tutorial 6. Andy Wright Super Advanced BSV* October 24, / 25 Super Advanced BSV* Andy Wright October 24, 2014 *Edited for 6.175 Tutorial 6 Andy Wright Super Advanced BSV* October 24, 2014 1 / 25 Super Advanced BSV Scheduling! Andy Wright Super Advanced BSV* October

More information

CSE140L: Components and Design

CSE140L: Components and Design CSE140L: Components and Design Techniques for Digital Systems Lab Tajana Simunic Rosing Source: Vahid, Katz, Culler 1 Grade distribution: 70% Labs 35% Lab 4 30% Lab 3 20% Lab 2 15% Lab 1 30% Final exam

More information

Multiple Clock Domains

Multiple Clock Domains Multiple Clock Domains Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Based on material prepared by Bluespec Inc L13-1 Why Multiple Clock Domains Arise naturally

More information

Lecture 14. Synthesizing Parallel Programs IAP 2007 MIT

Lecture 14. Synthesizing Parallel Programs IAP 2007 MIT 6.189 IAP 2007 Lecture 14 Synthesizing Parallel Programs Prof. Arvind, MIT. 6.189 IAP 2007 MIT Synthesizing parallel programs (or borrowing some ideas from hardware design) Arvind Computer Science & Artificial

More information

Register Transfer Level in Verilog: Part I

Register Transfer Level in Verilog: Part I Source: M. Morris Mano and Michael D. Ciletti, Digital Design, 4rd Edition, 2007, Prentice Hall. Register Transfer Level in Verilog: Part I Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National

More information

ECE 4514 Digital Design II. Spring Lecture 13: Logic Synthesis

ECE 4514 Digital Design II. Spring Lecture 13: Logic Synthesis ECE 4514 Digital Design II A Tools/Methods Lecture Second half of Digital Design II 9 10-Mar-08 L13 (T) Logic Synthesis PJ2 13-Mar-08 L14 (D) FPGA Technology 10 18-Mar-08 No Class (Instructor on Conference)

More information

Lab 1: Hello World, Adders, and Multipliers

Lab 1: Hello World, Adders, and Multipliers Lab 1: Hello World, Adders, and Multipliers Andy Wright acwright@mit.edu Updated: December 30, 2013 1 Hello World! 1 interface GCD#(numeric type n); method Action computegcd(uint#(n) a, UInt#(n) b); method

More information

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog ECE 2300 Digital Logic & Computer Organization Spring 2018 More Sequential Logic Verilog Lecture 7: 1 Announcements HW3 will be posted tonight Prelim 1 Thursday March 1, in class Coverage: Lectures 1~7

More information

Sequential Circuits. Combinational circuits

Sequential Circuits. Combinational circuits ecoder emux onstructive omputer Architecture Sequential ircuits Arvind omputer Science & Artificial Intelligence Lab. Massachusetts Institute of Technology L04-1 ombinational circuits A 0 A 1 A n-1 Sel...

More information

6.175: Constructive Computer Architecture. Tutorial 1 Bluespec SystemVerilog (BSV) Sep 30, 2016

6.175: Constructive Computer Architecture. Tutorial 1 Bluespec SystemVerilog (BSV) Sep 30, 2016 6.175: Constructive Computer Architecture Tutorial 1 Bluespec SystemVerilog (BSV) Quan Nguyen (Only crashed PowerPoint three times) T01-1 What s Bluespec? A synthesizable subset of SystemVerilog Rule-based

More information

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis Synthesis of Language Constructs 1 Nets Nets declared to be input or output ports are retained Internal nets may be eliminated due to logic optimization User may force a net to exist trireg, tri0, tri1

More information

Transmitter Overview

Transmitter Overview Multiple Clock Domains Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Based on material prepared by Bluespec Inc L12-1 802.11 Transmitter Overview headers Controller

More information

Subject: Scheduling Region Questions and Problems of new SystemVerilog commands

Subject: Scheduling Region Questions and Problems of new SystemVerilog commands Subject: Scheduling Region Questions and Problems of new SystemVerilog commands I have read and re-read sections 14-17 of the SystemVerilog 3.1 Standard multiple times and am still confused about exactly

More information

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis

Logic Synthesis. EECS150 - Digital Design Lecture 6 - Synthesis Logic Synthesis Verilog and VHDL started out as simulation languages, but quickly people wrote programs to automatically convert Verilog code into low-level circuit descriptions (netlists). EECS150 - Digital

More information

Chapter 4. The Processor

Chapter 4. The Processor Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle time Determined by CPU hardware We will examine two MIPS implementations A simplified

More information

Synthesis of Synchronous Assertions with Guarded Atomic Actions

Synthesis of Synchronous Assertions with Guarded Atomic Actions Synthesis of Synchronous Assertions with Guarded Atomic Actions Michael Pellauer, Mieszko Lis, Donald Baltus, Rishiyur Nikhil Massachusetts Institute of Technology Bluespec, Inc. pellauer@csail.mit.edu,

More information

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis

EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis EECS150 - Digital Design Lecture 5 - Verilog Logic Synthesis Jan 31, 2012 John Wawrzynek Spring 2012 EECS150 - Lec05-verilog_synth Page 1 Outline Quick review of essentials of state elements Finite State

More information

Digital Design with FPGAs. By Neeraj Kulkarni

Digital Design with FPGAs. By Neeraj Kulkarni Digital Design with FPGAs By Neeraj Kulkarni Some Basic Electronics Basic Elements: Gates: And, Or, Nor, Nand, Xor.. Memory elements: Flip Flops, Registers.. Techniques to design a circuit using basic

More information

Simple Inelastic and

Simple Inelastic and Simple Inelastic and Folded Pipelines Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology L04-1 Pipelining a block C f1 f2 f3 Combinational P f1 f2 f3 Pipeline FP

More information

Hardware Design Environments. Dr. Mahdi Abbasi Computer Engineering Department Bu-Ali Sina University

Hardware Design Environments. Dr. Mahdi Abbasi Computer Engineering Department Bu-Ali Sina University Hardware Design Environments Dr. Mahdi Abbasi Computer Engineering Department Bu-Ali Sina University Outline Welcome to COE 405 Digital System Design Design Domains and Levels of Abstractions Synthesis

More information

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1

Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis. Spring 2007 Lec #8 -- HW Synthesis 1 Verilog Synthesis Synthesis vs. Compilation Descriptions mapped to hardware Verilog design patterns for best synthesis Spring 2007 Lec #8 -- HW Synthesis 1 Logic Synthesis Verilog and VHDL started out

More information

Achieving Timing Closure with Bluespec SystemVerilog

Achieving Timing Closure with Bluespec SystemVerilog Achieving Timing Closure with Bluespec SystemVerilog White Paper August 18, 2004 2004, Bluespec, Inc. All rights reserved Introduction Achieving timing closure becomes increasingly difficult with more

More information

ENGR 3410: MP #1 MIPS 32-bit Register File

ENGR 3410: MP #1 MIPS 32-bit Register File ENGR 3410: MP #1 MIPS 32-bit Register File Due: Before class, September 23rd, 2008 1 Introduction The purpose of this machine problem is to create the first large component of our MIPS-style microprocessor

More information

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle

More information

ENGR 3410: MP #1 MIPS 32-bit Register File

ENGR 3410: MP #1 MIPS 32-bit Register File ENGR 3410: MP #1 MIPS 32-bit Register File Due: October 12, 2007, 5pm 1 Introduction The purpose of this machine problem is to create the first large component of our MIPS-style microprocessor the register

More information

Superscalar SMIPS Processor

Superscalar SMIPS Processor Superscalar SMIPS Processor Group 2 Qian (Vicky) Liu Cliff Frey 1 Introduction Our project is the implementation of a superscalar processor that implements the SMIPS specification. Our primary goal is

More information

Nikhil Gupta. FPGA Challenge Takneek 2012

Nikhil Gupta. FPGA Challenge Takneek 2012 Nikhil Gupta FPGA Challenge Takneek 2012 RECAP FPGA Field Programmable Gate Array Matrix of logic gates Can be configured in any way by the user Codes for FPGA are executed in parallel Configured using

More information

6.375 Tutorial 1 BSV. Ming Liu. Overview. Parts of a BSV module Lab 2 topics More types in BSV

6.375 Tutorial 1 BSV. Ming Liu. Overview. Parts of a BSV module Lab 2 topics More types in BSV 6.375 Tutorial 1 BSV Ming Liu T01-1 Overview Parts of a BSV module Lab 2 topics More types in BSV T01-2 1 Modules Interfaces Methods provide a way for the outside world to interact with the module State

More information

Verilog for Synthesis Ing. Pullini Antonio

Verilog for Synthesis Ing. Pullini Antonio Verilog for Synthesis Ing. Pullini Antonio antonio.pullini@epfl.ch Outline Introduction to Verilog HDL Describing combinational logic Inference of basic combinational blocks Describing sequential circuits

More information

Laboratory Exercise 7

Laboratory Exercise 7 Laboratory Exercise 7 Finite State Machines This is an exercise in using finite state machines. Part I We wish to implement a finite state machine (FSM) that recognizes two specific sequences of applied

More information

ENGR 3410: Lab #1 MIPS 32-bit Register File

ENGR 3410: Lab #1 MIPS 32-bit Register File ENGR 3410: Lab #1 MIPS 32-bit Register File Due: October 12, 2005, beginning of class 1 Introduction The purpose of this lab is to create the first large component of our MIPS-style microprocessor the

More information

IP Lookup block in a router

IP Lookup block in a router P Lookup: Some subtle concurrency issues Arvind Computer Science & Artificial ntelligence Lab Massachusetts nstitute of Technology L06-1 P Lookup block in a router Packet Processor S (lookup table) P Lookup

More information

NOW Handout Page 1. Review from Last Time #1. CSE 820 Graduate Computer Architecture. Lec 8 Instruction Level Parallelism. Outline

NOW Handout Page 1. Review from Last Time #1. CSE 820 Graduate Computer Architecture. Lec 8 Instruction Level Parallelism. Outline CSE 820 Graduate Computer Architecture Lec 8 Instruction Level Parallelism Based on slides by David Patterson Review Last Time #1 Leverage Implicit Parallelism for Performance: Instruction Level Parallelism

More information

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design 1 In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design a fininte state machine in order to produce the desired

More information

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design a fininte state machine in order to produce the desired

More information

MODELING LANGUAGES AND ABSTRACT MODELS. Giovanni De Micheli Stanford University. Chapter 3 in book, please read it.

MODELING LANGUAGES AND ABSTRACT MODELS. Giovanni De Micheli Stanford University. Chapter 3 in book, please read it. MODELING LANGUAGES AND ABSTRACT MODELS Giovanni De Micheli Stanford University Chapter 3 in book, please read it. Outline Hardware modeling issues: Representations and models. Issues in hardware languages.

More information

VHDL for Synthesis. Course Description. Course Duration. Goals

VHDL for Synthesis. Course Description. Course Duration. Goals VHDL for Synthesis Course Description This course provides all necessary theoretical and practical know how to write an efficient synthesizable HDL code through VHDL standard language. The course goes

More information

Design of Digital Circuits ( L) ETH Zürich, Spring 2017

Design of Digital Circuits ( L) ETH Zürich, Spring 2017 Name: Student ID: Final Examination Design of Digital Circuits (252-0028-00L) ETH Zürich, Spring 2017 Professors Onur Mutlu and Srdjan Capkun Problem 1 (70 Points): Problem 2 (50 Points): Problem 3 (40

More information

Overview. BSV reviews/notes Guard lifting EHRs Scheduling Lab Tutorial 2 Guards and Scheduling. Ming Liu

Overview. BSV reviews/notes Guard lifting EHRs Scheduling Lab Tutorial 2 Guards and Scheduling. Ming Liu 6.375 Tutorial 2 Guards and Scheduling Ming Liu T02-1 Overview BSV reviews/notes Guard lifting EHRs Scheduling Lab 3 T02-2 1 Expressions vs. Actions Expressions Have no side effects (state changes) Can

More information

ARM 64-bit Register File

ARM 64-bit Register File ARM 64-bit Register File Introduction: In this class we will develop and simulate a simple, pipelined ARM microprocessor. Labs #1 & #2 build some basic components of the processor, then labs #3 and #4

More information

Verilog for High Performance

Verilog for High Performance Verilog for High Performance Course Description This course provides all necessary theoretical and practical know-how to write synthesizable HDL code through Verilog standard language. The course goes

More information

1 Design Process HOME CONTENTS INDEX. For further assistance, or call your local support center

1 Design Process HOME CONTENTS INDEX. For further assistance,  or call your local support center 1 Design Process VHDL Compiler, a member of the Synopsys HDL Compiler family, translates and optimizes a VHDL description to an internal gate-level equivalent. This representation is then compiled with

More information

ECE 2300 Digital Logic & Computer Organization. More Finite State Machines

ECE 2300 Digital Logic & Computer Organization. More Finite State Machines ECE 2300 Digital Logic & Computer Organization Spring 2018 More Finite State Machines Lecture 9: 1 Announcements Prelab 3(B) due tomorrow Lab 4 to be released tonight You re not required to change partner(s)

More information

ECEN 468 Advanced Logic Design

ECEN 468 Advanced Logic Design ECEN 468 Advanced Logic Design Lecture 28: Synthesis of Language Constructs Synthesis of Nets v An explicitly declared net may be eliminated in synthesis v Primary input and output (ports) are always retained

More information

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor

COMPUTER ORGANIZATION AND DESIGN. 5 th Edition. The Hardware/Software Interface. Chapter 4. The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition The Processor - Introduction

More information

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor.

Chapter 4. Instruction Execution. Introduction. CPU Overview. Multiplexers. Chapter 4 The Processor 1. The Processor. COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor The Processor - Introduction

More information

AS part of my MPhil course Advanced Computer Design, I was required to choose or define a challenging hardware project

AS part of my MPhil course Advanced Computer Design, I was required to choose or define a challenging hardware project OMAR CHOUDARY, ADVANCED COMPUTER DESIGN, APRIL 2010 1 From Verilog to Bluespec: Tales of an AES Implementation for FPGAs Omar Choudary, University of Cambridge Abstract In this paper I present a combined

More information

Quick Introduction to SystemVerilog: Sequental Logic

Quick Introduction to SystemVerilog: Sequental Logic ! Quick Introduction to SystemVerilog: Sequental Logic Lecture L3 8-545 Advanced Digital Design ECE Department Many elements Don Thomas, 24, used with permission with credit to G. Larson Today Quick synopsis

More information

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto Recommed Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto DISCLAIMER: The information contained in this document does NOT contain

More information

What, If Anything, In SystemVerilog Will Help Me With FPGA-based Design. Stuart Sutherland, Consultant and Trainer, Sutherland HDL, Inc.

What, If Anything, In SystemVerilog Will Help Me With FPGA-based Design. Stuart Sutherland, Consultant and Trainer, Sutherland HDL, Inc. What, If Anything, In SystemVerilog Will Help Me With FPGA-based Design Stuart Sutherland, Consultant and Trainer, Sutherland HDL, Inc. About the Presenter... Stuart Sutherland, SystemVerilog wizard Independent

More information

Lecture 5: Instruction Pipelining. Pipeline hazards. Sequential execution of an N-stage task: N Task 2

Lecture 5: Instruction Pipelining. Pipeline hazards. Sequential execution of an N-stage task: N Task 2 Lecture 5: Instruction Pipelining Basic concepts Pipeline hazards Branch handling and prediction Zebo Peng, IDA, LiTH Sequential execution of an N-stage task: 3 N Task 3 N Task Production time: N time

More information

Schematic design. Gate level design. 0 EDA (Electronic Design Assistance) 0 Classical design. 0 Computer based language

Schematic design. Gate level design. 0 EDA (Electronic Design Assistance) 0 Classical design. 0 Computer based language 1 / 15 2014/11/20 0 EDA (Electronic Design Assistance) 0 Computer based language 0 HDL (Hardware Description Language) 0 Verilog HDL 0 Created by Gateway Design Automation Corp. in 1983 First modern hardware

More information

High Performance SMIPS Processor

High Performance SMIPS Processor High Performance SMIPS Processor Jonathan Eastep 6.884 Final Project Report May 11, 2005 1 Introduction 1.1 Description This project will focus on producing a high-performance, single-issue, in-order,

More information

Lecture 15: System Modeling and Verilog

Lecture 15: System Modeling and Verilog Lecture 15: System Modeling and Verilog Slides courtesy of Deming Chen Intro. VLSI System Design Outline Outline Modeling Digital Systems Introduction to Verilog HDL Use of Verilog HDL in Synthesis Reading

More information

Chapter 10. case studies in sequential logic design

Chapter 10. case studies in sequential logic design Chapter. case studies in sequential logic design This is the last chapter of this course. So far, we have designed several sequential systems. What is the general procedure? The most difficult part would

More information

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. 5 th. Edition. Chapter 4. The Processor

COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. 5 th. Edition. Chapter 4. The Processor COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface 5 th Edition Chapter 4 The Processor Introduction CPU performance factors Instruction count Determined by ISA and compiler CPI and Cycle

More information

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design

Verilog. What is Verilog? VHDL vs. Verilog. Hardware description language: Two major languages. Many EDA tools support HDL-based design Verilog What is Verilog? Hardware description language: Are used to describe digital system in text form Used for modeling, simulation, design Two major languages Verilog (IEEE 1364), latest version is

More information

CSE 820 Graduate Computer Architecture. week 6 Instruction Level Parallelism. Review from Last Time #1

CSE 820 Graduate Computer Architecture. week 6 Instruction Level Parallelism. Review from Last Time #1 CSE 820 Graduate Computer Architecture week 6 Instruction Level Parallelism Based on slides by David Patterson Review from Last Time #1 Leverage Implicit Parallelism for Performance: Instruction Level

More information

System Verilog Tagged Unions and Pattern Matching

System Verilog Tagged Unions and Pattern Matching System Verilog Tagged Unions and Pattern Matching (An extension to System Verilog 3.1 proposed to Accellera) Bluespec, Inc. Contact: Rishiyur S. Nikhil, CTO, Bluespec, Inc. 200 West Street, 4th Flr., Waltham,

More information

Bluespec-5: Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology

Bluespec-5: Modeling Processors. Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Bluespec-5: Modeling Processors (revised after the lecture) Arvind Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology Based on material prepared by Bluespec Inc, January

More information

EECS150 - Digital Design Lecture 10 Logic Synthesis

EECS150 - Digital Design Lecture 10 Logic Synthesis EECS150 - Digital Design Lecture 10 Logic Synthesis September 26, 2002 John Wawrzynek Fall 2002 EECS150 Lec10-synthesis Page 1 Logic Synthesis Verilog and VHDL stated out as simulation languages, but quickly

More information

EECS150 - Digital Design Lecture 4 - Verilog Introduction. Outline

EECS150 - Digital Design Lecture 4 - Verilog Introduction. Outline EECS150 - Digital Design Lecture 4 - Verilog Introduction Feb 3, 2009 John Wawrzynek Spring 2009 EECS150 - Lec05-Verilog Page 1 Outline Background and History of Hardware Description Brief Introduction

More information

FPGA for Software Engineers

FPGA for Software Engineers FPGA for Software Engineers Course Description This course closes the gap between hardware and software engineers by providing the software engineer all the necessary FPGA concepts and terms. The course

More information