

































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


































"To Design is to Represent"
Architectural Simulation
Functional/Behavioral
Register Transfer
Logic
Circuit
Goals:
Concepts:
Module/Design Entity ==
Interface == External
Architecture (Body ) ==
Operators borrowed from C programming language
= < <= ! && ||
== != ?: {} % === !== ~ & | << >>
Arithmetic Relational Logical Logical equality Conditional Concatenate Modulus Case equality Bit-wise Shift
Unlike conventional programs, not a serial model of execution
Global variable designates simulation time
module repeat_loop (clock); input clock; initial begin repeat (5) @(posedge clock); $stop; end endmodule
Initial: execute at start of sim Wait for 5 positive clock edges Stop simulation
Synchronous: #expression – suspend execution for indicated time Asynchronous: @expression – suspend execution until event occurs Level: wait (expression) – suspend execution until expression true
module time_control; reg[1:0] r; initial #70 $stop; initial begin : b1 //named block b #10 r = 1; //wait for 10 time units #20 r = 1; //wait for 20 time units #30 r = 1; //wait for 30 time units end initial begin : b2 //named block b #5 r = 2; //wait for 5 time units #20 r = 2; //wait for 20 time units #30 r = 2; //wait for 30 time units end always @r begin $display (“r= %0d at time %0d”, r, $time); end endmodule
add add $1,$2,$3 $1 = $2 + $3 3 operands; exception possible subtract sub $1,$2,$3 $1 = $2 – $3 3 operands; exception possible add immediate addi $1,$2,100 $1 = $2 + 100 + constant; exception possible add unsigned addu $1,$2,$3 $1 = $2 + $3 3 operands; no exceptions subtract unsigned subu $1,$2,$3 $1 = $2 – $3 3 operands; no exceptions add imm. unsign. addiu $1,$2,100 $1 = $2 + 100 + constant; no exceptions multiply mult $2,$3 Hi, Lo = $2 x $3 64-bit signed product multiply unsigned multu$2,$3 Hi, Lo = $2 x $3 64-bit unsigned product divide div $2,$3 Lo = $2 ÷ $3, Lo = quotient, Hi = remainder Hi = $2 mod $ divide unsigned divu $2,$3 Lo = $2 ÷ $3, Unsigned quotient & remainder Hi = $2 mod $ Move from Hi mfhi $1 $1 = Hi Used to get copy of Hi Move from Lo mflo $1 $1 = Lo Used to get copy of Lo
Paper and pencil example (unsigned):
Multiplicand 1000 Multiplier 1001 1000 0000 0000 1000 Product 01001000
m bits x n bits = m+n bit product
Binary makes it easy:
Four versions of multiply hardware & algorithm:
Add Columns first,
then rows!
Can be used to
reduce critical path of multiply
Example: 53 bit
multiply (for floating point):
Carry Save Adder3=>
I 1 I (^2)
S 1 S (^0)
I (^3) Carry Save Adder3=>
I 1 I (^2)
S 1 S (^0)
I (^3) Carry Save Adder3=>
I 1 I (^2)
S 1 S (^0)
I (^3)
0
C 2
Carry Save Adder3=>
I 1 I (^2)
S 1 S (^0)
I (^3) Carry Save Adder3=>
I 1 I (^2)
S 1 S (^0)
I (^3) Carry Save Adder3=>
I 1 I (^2)
S 1 S (^0)
I (^3)
S 4 S 3 S 2 S 1 S 0
Carry Save Adder3=>
I 1 I (^2)
S 1 S (^0)
I (^3) Carry Save Adder3=>
I 1 I (^2)
S 1 S (^0)
I (^3)
0
Carry Save Adder3=>
I 1 I (^2)
S 1 S (^0)
I (^3)
B 2 A 2 C 1 B 1 A 1 C 0 B 0 A 0
D 2 D 1 D 0
At each stage shift A left ( x 2)
Use next bit of B to determine whether to add in shifted multiplicand
Accumulate 2n bit partial product at each stage
B 0
A 3 A 2 A 1 A 0
A 3 A 2 A 1 A 0
A 3 A 2 A 1 A 0
A 3 A 2 A 1 A 0
B 1
B 2
B 3
P 7 P 6 P 5 P 4 P 3 P 2 P 1 P 0
0 0 0 0 0 0 0
No: < 32 repetitions
32nd repetition?