Beruflich Dokumente
Kultur Dokumente
automatic tools to
synthesize a low-level
gate-level model
Gate Level
input_available result_rdy
idle result_taken
operand_A result_data
operand_B
clk reset
designed to
be either busy
or waiting for
A A B B input or
sel en sel en B=0 A<B waiting for
output to be
picked up
zero? lt
A = inA; B = inB;
A
while ( !done )
sub begin
if ( A < B )
swap = A;
B
A = B;
B = swap;
else if (B != 0)
A = A - B;
else
done = 1;
End
February 9, 2009 http://csg.csail.mit.edu/6.375/ Y = A; L03-23
Datapath module interface
module gcdGCDUnitDpath_sstr#( parameter W = 16 )
( input clk,
A A B B
sel en sel en B=0 A<B
// Data signals
input [W-1:0] operand_A,
input [W-1:0] operand_B, zero? lt
output [W-1:0] result_data, A
sub
vcMux3#(W) A_mux
( .in0 (operand_A),
zero? lt
.in1 (B),
A
.in2 (sub_out), sub
.sel (A_sel),
.out (A_out) ); B
wire [W-1:0] A;
vcEDFF_pf#(W) A_pf
( .clk (clk),
.en_p (A_en),
.d_p (A_out),
.q_np (A) );
February 9, 2009 http://csg.csail.mit.edu/6.375/ L03-25
Connect the modules ...
wire [W-1:0] B; wire [W-1:0] B_out;
wire [W-1:0] sub_out; Using explicit
wire [W-1:0] A_out; vcMux2#(W) B_mux state helps
( .in0 (operand_B), eliminate issues
vcMux3#(W) A_mux .in1 (A), with non-blocking
( .in0 (operand_A), .sel (B_sel), assignments
.in1 (B), .out (B_out) );
.in2 (sub_out),
.sel (A_sel), vcEDFF_pf#(W) B_pf Continuous
.out (A_out) ); ( .clk (clk), assignment
.en_p (B_en), combinational
wire [W-1:0] A; .d_p (B_out), logic is fine
vcEDFF_pf#(W) A_pf .q_np (B) );
( .clk (clk),
.en_p (A_en), assign B_zero = (B==0);
.d_p (A_out), assign A_lt_B = (A < B);
.q_np (A) ); assign sub_out = A - B;
assign result_data = A;
February 9, 2009 http://csg.csail.mit.edu/6.375/ L03-26
Control unit requires a state
machine for valid/ready signals
reset
WAIT Waiting for new input operands
input_availble
(B=0)
vcRDFF_pf#(2,WAIT)
state_pf
( .clk (clk),
.reset_p (reset),
.d_p (state_next), Explicit state in the control
.q_np (state) );
logic is also a good idea!
A A B B
sel en sel en B=0 A<B
Behavioral RTL
Model Model
Identical?
SMIPSv2
35 instructions
No exceptions/interrupts
ISA for lab assignments
SMIPSv3
58 instructions
Full system coproc with exceptions/Interrupts
Optional ISA for projects
localparam cs_sz = 8;
reg [cs_sz-1:0] cs; casez performs simple pattern
matching and can be very useful
always @(*)
begin
when implementing decoders
cs = {cs_sz{1'b0}};
casez ( imemresp_data )
// op0 mux op1 mux wb mux rfile mreq mreq tohost