Test1.soln

Test1.soln - port(s in state st r0 in bit rdy lr cln ld clq...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CMPT 250 00-3 : TEST #1 SOLUTIONS Question 1 : r0 n32 Q0 out2 out1 c_in cm up cln clq slq srd ld lr s op2 op1 N>32 R<0 S FA 2 1 N Q CMPL D R 1 0 MUX
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Question 2a : n32 n32’ st S3 S2 S1 S0 Question 2b : type state is (S0, S1, S2); entity SEQ is port(st, n32: in bit; s: out state); end SEQ; Architecture behav of SEQ is begin proc: process(clk) variable curr_state: state := S0; begin if clk = ’1’ then case curr_state is when S0 => if st = ’1’ then curr_state := S1; end if; when S1 => curr_state := S2; when S2 => curr_state := S3; when S3 => if n32 = ’1’ then curr_state := S0; else curr_state := S1; end if; end case; s <= curr_state; end if; end process; end behav;
Background image of page 2
3 Question 3a S0: rdy S0 * st: lr, cln, ld, clq S1: up, cm, lr, c_in S2 * r0: slq, lr S2 * r0’: slq, Q(0) S3: srd Question 3b : entity CPE is
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: port(s: in state; st, r0: in bit; rdy, lr, cln, ld, clq, up, cm, slq, Q0, srd: out bit); end CPE; architecture behav of CPE is begin proc:process(s, st, r0) begin rdy <= ’0’; lr <= 0’; cln <= ’0’; ld <= ’0’; clq <= ’0’; up <= ’0’; cm <= ’0’; slq <= ’0’; Q0 <= ’0’; srd <= ’0’; case s is when S0 => rdy <= 1; if st = ’1’ then lr <= ’1’; cln <= ’1’; ld <= ’1’; clq <= ’1’; end if; when S1 => up <= ’1’; cm <= ’1’; lr <= ’1’; when S2 => slq <= ’1’; if r0 = ’1’ then lr <= ’1’; else Q0 <= ’1’; when S3 => srd <= ’1’; end case; end process end behav;...
View Full Document

This note was uploaded on 01/16/2010 for the course CS 251 taught by Professor Various during the Spring '97 term at Simon Fraser.

Page1 / 3

Test1.soln - port(s in state st r0 in bit rdy lr cln ld clq...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online