Control Path Design and Lab 3
1
Control Path Design and Lab 3 1 Separating Control From Data The - - PowerPoint PPT Presentation
Control Path Design and Lab 3 1 Separating Control From Data The datapath is where data moves from place to place. Computation happens in the datapath No decisions are made here. Things you should find in a datapath Muxes
1
2
exploit.
chips.
and I will tell you to go fix the coding style issues first.
3
4
Control Datapath Signals controlling the datapath Signals providing information to control Outputs Data inputs Control inputs control outputs clk reset clk reset
5
6
7
8
9
@ (posedge clk or reset)
10
11
always @(*) begin // Default is to stay in the same state state_next = state; case ( state ) STATE_1 : if ( something && something_else) state_next = ANOTHER_STATE; ANOTHER_STATE : if ( sky_falls ) state_next = SCREAM; SCREAM : state_next = WAIT; ... endcase end
12
always @(*) begin //Default control signals some_mux_sel_out = SOME_MUX_SEL_X; reg_en_out = 1'b0; case ( state ) STATE_1: begin some_mux_sel_out = 1’b1; end ANOTHER_STATE: if ( sufficient_love_in ) begin reg_en_out = 1’b1; end else if ( is_monday_in ) begin reg_en_out = 1’b0; end ... endcase end
13
always @(posedge clk or reset) if (reset) state <= WAIT; else state <= state_next;
14
15
TrivialScalar reg_sel
+1 Reg File Decode Imem ALU Dmem PC r1 r2 result r_data ld_data next_pc st_data addr imm run_stall_reset dmem_write_en regfile_write_en inst read_write_req in_req
in_ack TrivialScalar_Control -- Lab 3
IO Interface in_data v1 v2
16